id
int32
0
12.9k
code
sequencelengths
2
264k
2,300
[ "<s>", "public", "class", "JavaMain", "{", "public", "static", "void", "main", "(", "String", "...", "args", ")", "{", "new", "GroovyHello", "(", ")", ".", "sayHello", "(", ")", ";", "new", "JavaHello", "(", ")", ".", "sayHello", "(", ")", ";", "}", "}", "</s>" ]
2,301
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "m2eclipse", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Plugin", ";", "import", "org", ".", "osgi", ".", "framework", ".", "BundleContext", ";", "public", "class", "Activator", "extends", "Plugin", "{", "public", "static", "final", "String", "PLUGIN_ID", "=", "\"\"", ";", "private", "static", "Activator", "plugin", ";", "public", "Activator", "(", ")", "{", "}", "public", "void", "start", "(", "BundleContext", "context", ")", "throws", "Exception", "{", "super", ".", "start", "(", "context", ")", ";", "plugin", "=", "this", ";", "}", "public", "void", "stop", "(", "BundleContext", "context", ")", "throws", "Exception", "{", "plugin", "=", "null", ";", "super", ".", "stop", "(", "context", ")", ";", "}", "public", "static", "Activator", "getDefault", "(", ")", "{", "return", "plugin", ";", "}", "}", "</s>" ]
2,302
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "m2eclipse", ";", "import", "org", ".", "apache", ".", "maven", ".", "model", ".", "Dependency", ";", "import", "org", ".", "apache", ".", "maven", ".", "model", ".", "Plugin", ";", "import", "org", ".", "apache", ".", "maven", ".", "model", ".", "PluginExecution", ";", "import", "org", ".", "apache", ".", "maven", ".", "project", ".", "MavenProject", ";", "import", "org", ".", "codehaus", ".", "groovy", ".", "eclipse", ".", "core", ".", "model", ".", "GroovyRuntime", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "model", ".", "GroovyNature", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "m2e", ".", "core", ".", "project", ".", "IMavenProjectFacade", ";", "import", "org", ".", "eclipse", ".", "m2e", ".", "core", ".", "project", ".", "configurator", ".", "ProjectConfigurationRequest", ";", "import", "org", ".", "eclipse", ".", "m2e", ".", "jdt", ".", "IClasspathDescriptor", ";", "import", "org", ".", "eclipse", ".", "m2e", ".", "jdt", ".", "IJavaProjectConfigurator", ";", "import", "org", ".", "eclipse", ".", "m2e", ".", "jdt", ".", "internal", ".", "AbstractJavaProjectConfigurator", ";", "public", "class", "GroovyProjectConfigurator", "extends", "AbstractJavaProjectConfigurator", "implements", "IJavaProjectConfigurator", "{", "@", "Override", "public", "void", "configure", "(", "ProjectConfigurationRequest", "request", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "super", ".", "configure", "(", "request", ",", "monitor", ")", ";", "IProject", "project", "=", "request", ".", "getProject", "(", ")", ";", "if", "(", "getSourceType", "(", "request", ".", "getMavenProjectFacade", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "!", "project", ".", "hasNature", "(", "GroovyNature", ".", "GROOVY_NATURE", ")", ")", "{", "if", "(", "!", "project", ".", "hasNature", "(", "JavaCore", ".", "NATURE_ID", ")", ")", "{", "addJavaNature", "(", "project", ")", ";", "}", "GroovyRuntime", ".", "addGroovyNature", "(", "project", ")", ";", "}", "IJavaProject", "javaProject", "=", "JavaCore", ".", "create", "(", "project", ")", ";", "if", "(", "!", "GroovyRuntime", ".", "hasClasspathContainer", "(", "javaProject", ",", "GroovyRuntime", ".", "DSLD_CONTAINER_ID", ")", ")", "{", "GroovyRuntime", ".", "addLibraryToClasspath", "(", "javaProject", ",", "GroovyRuntime", ".", "DSLD_CONTAINER_ID", ",", "false", ")", ";", "}", "}", "else", "{", "GroovyRuntime", ".", "removeGroovyNature", "(", "project", ")", ";", "}", "}", "public", "void", "configureClasspath", "(", "IMavenProjectFacade", "facade", ",", "IClasspathDescriptor", "classpath", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "SourceType", "sourceType", "=", "getSourceType", "(", "facade", ")", ";", "if", "(", "sourceType", "!=", "null", ")", "{", "IJavaProject", "javaProject", "=", "JavaCore", ".", "create", "(", "facade", ".", "getProject", "(", ")", ")", ";", "IPath", "projectPath", "=", "facade", ".", "getFullPath", "(", ")", ";", "if", "(", "sourceType", "==", "SourceType", ".", "TEST", "||", "sourceType", "==", "SourceType", ".", "BOTH", ")", "{", "IPath", "testPath", "=", "projectPath", ".", "append", "(", "\"\"", ")", ";", "IPath", "testOutPath", "=", "projectPath", ".", "append", "(", "\"\"", ")", ";", "if", "(", "!", "hasEntry", "(", "javaProject", ",", "testPath", ")", ")", "{", "GroovyRuntime", ".", "addClassPathEntryToFront", "(", "javaProject", ",", "JavaCore", ".", "newSourceEntry", "(", "testPath", ",", "new", "Path", "[", "0", "]", ",", "testOutPath", ")", ")", ";", "}", "}", "if", "(", "sourceType", "==", "SourceType", ".", "MAIN", "||", "sourceType", "==", "SourceType", ".", "BOTH", ")", "{", "IPath", "sourcePath", "=", "projectPath", ".", "append", "(", "\"\"", ")", ";", "IPath", "sourceOutPath", "=", "projectPath", ".", "append", "(", "\"\"", ")", ";", "if", "(", "!", "hasEntry", "(", "javaProject", ",", "sourcePath", ")", ")", "{", "GroovyRuntime", ".", "addClassPathEntryToFront", "(", "javaProject", ",", "JavaCore", ".", "newSourceEntry", "(", "sourcePath", ",", "new", "Path", "[", "0", "]", ",", "sourceOutPath", ")", ")", ";", "}", "}", "IClasspathEntry", "[", "]", "allEntries", "=", "javaProject", ".", "getRawClasspath", "(", ")", ";", "for", "(", "IClasspathEntry", "entry", ":", "allEntries", ")", "{", "if", "(", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "javaProject", ".", "getProject", "(", ")", ".", "getFolder", "(", "\"\"", ")", ".", "getFullPath", "(", ")", ")", ")", "{", "GroovyRuntime", ".", "removeClassPathEntry", "(", "javaProject", ",", "entry", ")", ";", "break", ";", "}", "}", "}", "}", "private", "boolean", "hasEntry", "(", "IJavaProject", "javaProject", ",", "IPath", "path", ")", "throws", "JavaModelException", "{", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getRawClasspath", "(", ")", ";", "for", "(", "IClasspathEntry", "entry", ":", "entries", ")", "{", "if", "(", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "path", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "void", "configureRawClasspath", "(", "ProjectConfigurationRequest", "request", ",", "IClasspathDescriptor", "classpath", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "}", "private", "SourceType", "getSourceType", "(", "IMavenProjectFacade", "facade", ")", "{", "MavenProject", "mavenProject", "=", "facade", ".", "getMavenProject", "(", ")", ";", "Plugin", "plugin", "=", "getGMavenPlugin", "(", "mavenProject", ")", ";", "if", "(", "plugin", "!=", "null", ")", "{", "return", "getSourceTypeInGMavenProject", "(", "plugin", ")", ";", "}", "if", "(", "compilerPluginUsesGroovyEclipseAdapter", "(", "mavenProject", ")", ")", "{", "return", "getSourceTypeInGECProject", "(", "facade", ")", ";", "}", "return", "null", ";", "}", "private", "SourceType", "getSourceTypeInGMavenProject", "(", "Plugin", "plugin", ")", "{", "SourceType", "result", "=", "SourceType", ".", "NONE", ";", "if", "(", "plugin", "!=", "null", "&&", "plugin", ".", "getExecutions", "(", ")", "!=", "null", "&&", "!", "plugin", ".", "getExecutions", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "PluginExecution", "execution", ":", "plugin", ".", "getExecutions", "(", ")", ")", "{", "if", "(", "execution", ".", "getGoals", "(", ")", ".", "contains", "(", "COMPILE", ")", ")", "{", "switch", "(", "result", ")", "{", "case", "NONE", ":", "result", "=", "SourceType", ".", "MAIN", ";", "break", ";", "case", "TEST", ":", "result", "=", "SourceType", ".", "BOTH", ";", "break", ";", "}", "}", "if", "(", "execution", ".", "getGoals", "(", ")", ".", "contains", "(", "TEST_COMPILE", ")", ")", "{", "switch", "(", "result", ")", "{", "case", "NONE", ":", "result", "=", "SourceType", ".", "TEST", ";", "break", ";", "case", "MAIN", ":", "result", "=", "SourceType", ".", "BOTH", ";", "break", ";", "}", "}", "}", "}", "return", "result", ";", "}", "private", "SourceType", "getSourceTypeInGECProject", "(", "IMavenProjectFacade", "facade", ")", "{", "IProject", "project", "=", "facade", ".", "getProject", "(", ")", ";", "boolean", "srcMainGroovy", "=", "project", ".", "getFolder", "(", "\"\"", ")", ".", "exists", "(", ")", ";", "boolean", "srcTestGroovy", "=", "project", ".", "getFolder", "(", "\"\"", ")", ".", "exists", "(", ")", ";", "if", "(", "srcMainGroovy", ")", "{", "if", "(", "srcTestGroovy", ")", "{", "return", "SourceType", ".", "BOTH", ";", "}", "else", "{", "return", "SourceType", ".", "MAIN", ";", "}", "}", "else", "if", "(", "srcTestGroovy", ")", "{", "return", "SourceType", ".", "TEST", ";", "}", "else", "{", "return", "SourceType", ".", "NONE", ";", "}", "}", "private", "Plugin", "getGMavenPlugin", "(", "MavenProject", "mavenProject", ")", "{", "Plugin", "p", "=", "mavenProject", ".", "getPlugin", "(", "\"\"", ")", ";", "if", "(", "p", "==", "null", ")", "{", "p", "=", "mavenProject", ".", "getPlugin", "(", "\"\"", ")", ";", "}", "return", "p", ";", "}", "private", "boolean", "compilerPluginUsesGroovyEclipseAdapter", "(", "MavenProject", "mavenProject", ")", "{", "for", "(", "Plugin", "buildPlugin", ":", "mavenProject", ".", "getBuildPlugins", "(", ")", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "buildPlugin", ".", "getArtifactId", "(", ")", ")", "&&", "\"\"", ".", "equals", "(", "buildPlugin", ".", "getGroupId", "(", ")", ")", ")", "{", "for", "(", "Dependency", "dependency", ":", "buildPlugin", ".", "getDependencies", "(", ")", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "dependency", ".", "getArtifactId", "(", ")", ")", "&&", "\"\"", ".", "equals", "(", "dependency", ".", "getGroupId", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "return", "false", ";", "}", "private", "static", "final", "String", "COMPILE", "=", "\"compile\"", ";", "private", "static", "final", "String", "TEST_COMPILE", "=", "\"testCompile\"", ";", "private", "enum", "SourceType", "{", "MAIN", ",", "TEST", ",", "BOTH", ",", "NONE", "}", "public", "static", "void", "addJavaNature", "(", "final", "IProject", "project", ")", "throws", "CoreException", "{", "final", "IProjectDescription", "description", "=", "project", ".", "getDescription", "(", ")", ";", "final", "String", "[", "]", "ids", "=", "description", ".", "getNatureIds", "(", ")", ";", "final", "String", "[", "]", "newIds", "=", "new", "String", "[", "ids", "==", "null", "?", "1", ":", "ids", ".", "length", "+", "1", "]", ";", "newIds", "[", "0", "]", "=", "JavaCore", ".", "NATURE_ID", ";", "if", "(", "ids", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "newIds", ".", "length", ";", "i", "++", ")", "{", "newIds", "[", "i", "]", "=", "ids", "[", "i", "-", "1", "]", ";", "}", "}", "description", ".", "setNatureIds", "(", "newIds", ")", ";", "project", ".", "setDescription", "(", "description", ",", "null", ")", ";", "}", "}", "</s>" ]
2,303
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "eclipse", ".", "compiler", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "io", ".", "StringReader", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "java", ".", "net", ".", "URLDecoder", ";", "import", "java", ".", "security", ".", "CodeSource", ";", "import", "java", ".", "security", ".", "ProtectionDomain", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "NoSuchElementException", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "AbstractCompiler", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "CompilerConfiguration", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "CompilerError", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "CompilerException", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "CompilerOutputStyle", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "util", ".", "scan", ".", "InclusionScanException", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "util", ".", "scan", ".", "SourceInclusionScanner", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "util", ".", "scan", ".", "StaleSourceScanner", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "util", ".", "scan", ".", "mapping", ".", "SourceMapping", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "compiler", ".", "util", ".", "scan", ".", "mapping", ".", "SuffixMapping", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "FileUtils", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "Os", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "StringUtils", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "cli", ".", "CommandLineException", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "cli", ".", "CommandLineUtils", ";", "import", "org", ".", "codehaus", ".", "plexus", ".", "util", ".", "cli", ".", "Commandline", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CompilationProgress", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "batch", ".", "Main", ";", "public", "class", "GroovyEclipseCompiler", "extends", "AbstractCompiler", "{", "private", "static", "final", "String", "[", "]", "WARNING_PREFIXES", "=", "{", "\"warning:", "\"", ",", "\"-UNK-:", "\"", ",", "\"-UNK-", "\"", "}", ";", "private", "static", "final", "String", "[", "]", "NOTE_PREFIXES", "=", "{", "\"Note:", "\"", ",", "\"-UNK-:", "\"", ",", "\"-UNK-", "\"", "}", ";", "private", "static", "final", "String", "JAVA_AGENT_CLASS_PARAM_NAME", "=", "\"\"", ";", "private", "String", "javaAgentClass", "=", "\"\"", ";", "private", "class", "Progress", "extends", "CompilationProgress", "{", "private", "int", "count", "=", "0", ";", "public", "void", "begin", "(", "int", "remainingWork", ")", "{", "}", "public", "void", "done", "(", ")", "{", "if", "(", "verbose", ")", "{", "getLogger", "(", ")", ".", "info", "(", "\"\"", "+", "count", "+", "\"", "files.\"", ")", ";", "}", "}", "public", "boolean", "isCanceled", "(", ")", "{", "return", "false", ";", "}", "public", "void", "setTaskName", "(", "String", "newTaskName", ")", "{", "}", "public", "void", "worked", "(", "int", "workIncrement", ",", "int", "remainingWork", ")", "{", "if", "(", "verbose", ")", "{", "String", "file", "=", "remainingWork", "==", "1", "?", "\"file\"", ":", "\"files\"", ";", "getLogger", "(", ")", ".", "info", "(", "remainingWork", "+", "\"", "\"", "+", "file", "+", "\"", "left.\"", ")", ";", "count", "++", ";", "}", "}", "}", "boolean", "verbose", ";", "public", "GroovyEclipseCompiler", "(", ")", "{", "super", "(", "CompilerOutputStyle", ".", "ONE_OUTPUT_FILE_PER_INPUT_FILE", ",", "\"\"", ",", "\".class\"", ",", "null", ")", ";", "}", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "List", "compile", "(", "CompilerConfiguration", "config", ")", "throws", "CompilerException", "{", "String", "[", "]", "args", "=", "createCommandLine", "(", "config", ")", ";", "if", "(", "args", ".", "length", "==", "0", ")", "{", "getLogger", "(", ")", ".", "info", "(", "\"\"", ")", ";", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "List", "<", "CompilerError", ">", "messages", ";", "if", "(", "config", ".", "isFork", "(", ")", ")", "{", "String", "executable", "=", "config", ".", "getExecutable", "(", ")", ";", "if", "(", "StringUtils", ".", "isEmpty", "(", "executable", ")", ")", "{", "try", "{", "executable", "=", "getJavaExecutable", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "getLogger", "(", ")", ".", "warn", "(", "\"\"", ")", ";", "executable", "=", "\"java\"", ";", "}", "}", "String", "groovyEclipseLocation", "=", "getGroovyEclipseBatchLocation", "(", ")", ";", "messages", "=", "compileOutOfProcess", "(", "config", ",", "executable", ",", "groovyEclipseLocation", ",", "args", ")", ";", "}", "else", "{", "Progress", "progress", "=", "new", "Progress", "(", ")", ";", "Main", "main", "=", "new", "Main", "(", "new", "PrintWriter", "(", "System", ".", "out", ")", ",", "new", "PrintWriter", "(", "System", ".", "err", ")", ",", "false", ",", "null", ",", "progress", ")", ";", "boolean", "result", "=", "main", ".", "compile", "(", "args", ")", ";", "messages", "=", "formatResult", "(", "main", ",", "result", ")", ";", "}", "return", "messages", ";", "}", "private", "File", "[", "]", "recalculateStaleFiles", "(", "CompilerConfiguration", "config", ")", "throws", "CompilerException", "{", "config", ".", "setSourceFiles", "(", "null", ")", ";", "long", "staleMillis", "=", "0", ";", "Set", "<", "String", ">", "includes", "=", "config", ".", "getIncludes", "(", ")", ";", "if", "(", "includes", "==", "null", "||", "includes", ".", "isEmpty", "(", ")", ")", "{", "includes", "=", "Collections", ".", "singleton", "(", "\"**/*\"", ")", ";", "}", "StaleSourceScanner", "scanner", "=", "new", "StaleSourceScanner", "(", "staleMillis", ",", "includes", ",", "config", ".", "getExcludes", "(", ")", ")", ";", "Set", "<", "File", ">", "staleSources", "=", "computeStaleSources", "(", "config", ",", "scanner", ")", ";", "config", ".", "setSourceFiles", "(", "staleSources", ")", ";", "File", "[", "]", "sourceFiles", "=", "staleSources", ".", "toArray", "(", "new", "File", "[", "0", "]", ")", ";", "return", "sourceFiles", ";", "}", "private", "boolean", "startsWithHyphen", "(", "Object", "key", ")", "{", "return", "null", "!=", "key", "&&", "String", ".", "class", ".", "isInstance", "(", "key", ")", "&&", "(", "(", "String", ")", "key", ")", ".", "startsWith", "(", "\"-\"", ")", ";", "}", "private", "List", "<", "CompilerError", ">", "formatResult", "(", "Main", "main", ",", "boolean", "result", ")", "{", "if", "(", "result", ")", "{", "return", "Collections", ".", "EMPTY_LIST", ";", "}", "else", "{", "String", "error", "=", "main", ".", "globalErrorsCount", "==", "1", "?", "\"error\"", ":", "\"errors\"", ";", "String", "warning", "=", "main", ".", "globalWarningsCount", "==", "1", "?", "\"warning\"", ":", "\"warnings\"", ";", "return", "Collections", ".", "singletonList", "(", "new", "CompilerError", "(", "\"Found", "\"", "+", "main", ".", "globalErrorsCount", "+", "\"", "\"", "+", "error", "+", "\"", "and", "\"", "+", "main", ".", "globalWarningsCount", "+", "\"", "\"", "+", "warning", "+", "\".\"", ",", "true", ")", ")", ";", "}", "}", "private", "List", "<", "String", ">", "composeSourceFiles", "(", "File", "[", "]", "sourceFiles", ")", "{", "List", "<", "String", ">", "sources", "=", "new", "ArrayList", "<", "String", ">", "(", "sourceFiles", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sourceFiles", ".", "length", ";", "i", "++", ")", "{", "sources", ".", "add", "(", "sourceFiles", "[", "i", "]", ".", "getPath", "(", ")", ")", ";", "}", "return", "sources", ";", "}", "public", "String", "[", "]", "createCommandLine", "(", "CompilerConfiguration", "config", ")", "throws", "CompilerException", "{", "File", "destinationDir", "=", "new", "File", "(", "config", ".", "getOutputLocation", "(", ")", ")", ";", "if", "(", "!", "destinationDir", ".", "exists", "(", ")", ")", "{", "destinationDir", ".", "mkdirs", "(", ")", ";", "}", "File", "workingDirectory", "=", "config", ".", "getWorkingDirectory", "(", ")", ";", "if", "(", "destinationDir", ".", "getName", "(", ")", ".", "equals", "(", "\"classes\"", ")", ")", "{", "File", "srcMainGroovy", "=", "new", "File", "(", "workingDirectory", ",", "\"\"", ")", ";", "if", "(", "srcMainGroovy", ".", "exists", "(", ")", "&&", "!", "config", ".", "getSourceLocations", "(", ")", ".", "contains", "(", "srcMainGroovy", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "config", ".", "addSourceLocation", "(", "srcMainGroovy", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "if", "(", "destinationDir", ".", "getName", "(", ")", ".", "equals", "(", "\"test-classes\"", ")", ")", "{", "File", "srcTestGroovy", "=", "new", "File", "(", "workingDirectory", ",", "\"\"", ")", ";", "if", "(", "srcTestGroovy", ".", "exists", "(", ")", "&&", "!", "config", ".", "getSourceLocations", "(", ")", ".", "contains", "(", "srcTestGroovy", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "config", ".", "addSourceLocation", "(", "srcTestGroovy", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "File", "[", "]", "sourceFiles", "=", "recalculateStaleFiles", "(", "config", ")", ";", "if", "(", "sourceFiles", ".", "length", "==", "0", ")", "{", "return", "new", "String", "[", "0", "]", ";", "}", "getLogger", "(", ")", ".", "info", "(", "\"\"", ")", ";", "getLogger", "(", ")", ".", "debug", "(", "\"Compiling", "\"", "+", "sourceFiles", ".", "length", "+", "\"", "\"", "+", "\"source", "file\"", "+", "(", "sourceFiles", ".", "length", "==", "1", "?", "\"\"", ":", "\"s\"", ")", "+", "\"", "to", "\"", "+", "destinationDir", ".", "getAbsolutePath", "(", ")", ")", ";", "List", "<", "String", ">", "args", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "cp", "=", "super", ".", "getPathString", "(", "config", ".", "getClasspathEntries", "(", ")", ")", ";", "verbose", "=", "config", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "getLogger", "(", ")", ".", "info", "(", "\"Classpath:", "\"", "+", "cp", ")", ";", "}", "if", "(", "cp", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "\"-cp\"", ")", ";", "args", ".", "add", "(", "cp", ")", ";", "}", "if", "(", "config", ".", "getOutputLocation", "(", ")", "!=", "null", "&&", "config", ".", "getOutputLocation", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "\"-d\"", ")", ";", "args", ".", "add", "(", "config", ".", "getOutputLocation", "(", ")", ")", ";", "}", "if", "(", "config", ".", "isDebug", "(", ")", ")", "{", "if", "(", "config", ".", "getDebugLevel", "(", ")", "!=", "null", "&&", "config", ".", "getDebugLevel", "(", ")", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "\"-g:\"", "+", "config", ".", "getDebugLevel", "(", ")", ")", ";", "}", "else", "{", "args", ".", "add", "(", "\"-g\"", ")", ";", "}", "}", "if", "(", "\"none\"", ".", "equals", "(", "config", ".", "getProc", "(", ")", ")", ")", "{", "args", ".", "add", "(", "\"-proc:none\"", ")", ";", "}", "else", "if", "(", "\"only\"", ".", "equals", "(", "config", ".", "getProc", "(", ")", ")", ")", "{", "args", ".", "add", "(", "\"-proc:only\"", ")", ";", "}", "if", "(", "config", ".", "getGeneratedSourcesDirectory", "(", ")", "!=", "null", ")", "{", "args", ".", "add", "(", "\"-s\"", ")", ";", "args", ".", "add", "(", "config", ".", "getGeneratedSourcesDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "String", "source", "=", "config", ".", "getSourceVersion", "(", ")", ";", "args", ".", "add", "(", "\"-source\"", ")", ";", "if", "(", "source", "!=", "null", "&&", "source", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "source", ")", ";", "}", "else", "{", "args", ".", "add", "(", "\"1.5\"", ")", ";", "}", "String", "target", "=", "config", ".", "getTargetVersion", "(", ")", ";", "args", ".", "add", "(", "\"-target\"", ")", ";", "if", "(", "target", "!=", "null", "&&", "target", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "target", ")", ";", "}", "else", "{", "args", ".", "add", "(", "\"1.5\"", ")", ";", "}", "if", "(", "config", ".", "isShowDeprecation", "(", ")", ")", "{", "args", ".", "add", "(", "\"-deprecation\"", ")", ";", "}", "if", "(", "!", "config", ".", "isShowWarnings", "(", ")", ")", "{", "args", ".", "add", "(", "\"-nowarn\"", ")", ";", "}", "if", "(", "config", ".", "getAnnotationProcessors", "(", ")", "!=", "null", ")", "{", "StringBuilder", "procArg", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "proc", ":", "config", ".", "getAnnotationProcessors", "(", ")", ")", "{", "if", "(", "proc", "!=", "null", "&&", "proc", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "procArg", ".", "append", "(", "proc", ")", ";", "procArg", ".", "append", "(", "\",\"", ")", ";", "}", "}", "if", "(", "procArg", ".", "length", "(", ")", ">", "0", ")", "{", "args", ".", "add", "(", "\"-processor", "\"", ")", ";", "procArg", ".", "replace", "(", "procArg", ".", "length", "(", ")", "-", "1", ",", "procArg", ".", "length", "(", ")", ",", "\"\"", ")", ";", "args", ".", "add", "(", "\"\\\"\"", "+", "procArg", ".", "toString", "(", ")", "+", "\"\\\"\"", ")", ";", "}", "}", "if", "(", "verbose", ")", "{", "args", ".", "add", "(", "\"-verbose\"", ")", ";", "}", "if", "(", "config", ".", "getSourceEncoding", "(", ")", "!=", "null", ")", "{", "args", ".", "add", "(", "\"-encoding\"", ")", ";", "args", ".", "add", "(", "config", ".", "getSourceEncoding", "(", ")", ")", ";", "}", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "(", "Iterable", "<", "Entry", "<", "Object", ",", "Object", ">", ">", ")", "config", ".", "getCustomCompilerArguments", "(", ")", ".", "entrySet", "(", ")", ")", "{", "Object", "key", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "startsWithHyphen", "(", "key", ")", ")", "{", "if", "(", "JAVA_AGENT_CLASS_PARAM_NAME", ".", "equals", "(", "key", ")", ")", "{", "setJavaAgentClass", "(", "(", "String", ")", "entry", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "args", ".", "add", "(", "(", "String", ")", "key", ")", ";", "}", "}", "else", "if", "(", "key", "!=", "null", "&&", "!", "key", ".", "equals", "(", "\"\"", ")", ")", "{", "args", ".", "add", "(", "\"-\"", "+", "key", ")", ";", "if", "(", "null", "!=", "entry", ".", "getValue", "(", ")", ")", "{", "args", ".", "add", "(", "\"\\\"\"", "+", "entry", ".", "getValue", "(", ")", "+", "\"\\\"\"", ")", ";", "}", "}", "}", "args", ".", "addAll", "(", "composeSourceFiles", "(", "sourceFiles", ")", ")", ";", "if", "(", "verbose", ")", "{", "getLogger", "(", ")", ".", "info", "(", "\"All", "args:", "\"", "+", "args", ")", ";", "}", "return", "args", ".", "toArray", "(", "new", "String", "[", "args", ".", "size", "(", ")", "]", ")", ";", "}", "private", "Set", "<", "File", ">", "computeStaleSources", "(", "CompilerConfiguration", "compilerConfiguration", ",", "SourceInclusionScanner", "scanner", ")", "throws", "CompilerException", "{", "SourceMapping", "mappingGroovy", "=", "new", "SuffixMapping", "(", "\".groovy\"", ",", "\".class\"", ")", ";", "SourceMapping", "mappingJava", "=", "new", "SuffixMapping", "(", "\".java\"", ",", "\".class\"", ")", ";", "scanner", ".", "addSourceMapping", "(", "mappingGroovy", ")", ";", "scanner", ".", "addSourceMapping", "(", "mappingJava", ")", ";", "File", "outputDirectory", "=", "new", "File", "(", "compilerConfiguration", ".", "getOutputLocation", "(", ")", ")", ";", "Set", "<", "File", ">", "staleSources", "=", "new", "HashSet", "<", "File", ">", "(", ")", ";", "for", "(", "String", "sourceRoot", ":", "(", "List", "<", "String", ">", ")", "compilerConfiguration", ".", "getSourceLocations", "(", ")", ")", "{", "if", "(", "verbose", ")", "{", "getLogger", "(", ")", ".", "info", "(", "\"\"", "+", "sourceRoot", ")", ";", "}", "File", "rootFile", "=", "new", "File", "(", "sourceRoot", ")", ";", "if", "(", "!", "rootFile", ".", "isDirectory", "(", ")", ")", "{", "continue", ";", "}", "try", "{", "staleSources", ".", "addAll", "(", "scanner", ".", "getIncludedSources", "(", "rootFile", ",", "outputDirectory", ")", ")", ";", "}", "catch", "(", "InclusionScanException", "e", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", "+", "sourceRoot", "+", "\"'", "\"", "+", "\"\"", ",", "e", ")", ";", "}", "}", "return", "staleSources", ";", "}", "private", "List", "<", "CompilerError", ">", "compileOutOfProcess", "(", "CompilerConfiguration", "config", ",", "String", "executable", ",", "String", "groovyEclipseLocation", ",", "String", "[", "]", "args", ")", "throws", "CompilerException", "{", "Commandline", "cli", "=", "new", "Commandline", "(", ")", ";", "cli", ".", "setWorkingDirectory", "(", "config", ".", "getWorkingDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "cli", ".", "setExecutable", "(", "executable", ")", ";", "try", "{", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "javaAgentClass", ")", ")", "{", "cli", ".", "addArguments", "(", "new", "String", "[", "]", "{", "\"-javaagent:\"", "+", "getAdditionnalJavaAgentLocation", "(", ")", "}", ")", ";", "}", "else", "{", "getLogger", "(", ")", ".", "info", "(", "\"\"", ")", ";", "}", "cli", ".", "addArguments", "(", "new", "String", "[", "]", "{", "\"-jar\"", ",", "groovyEclipseLocation", "}", ")", ";", "File", "argumentsFile", "=", "createFileWithArguments", "(", "args", ",", "config", ".", "getOutputLocation", "(", ")", ")", ";", "cli", ".", "addArguments", "(", "new", "String", "[", "]", "{", "\"@\"", "+", "argumentsFile", ".", "getCanonicalPath", "(", ")", ".", "replace", "(", "File", ".", "separatorChar", ",", "'/'", ")", "}", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "config", ".", "getMaxmem", "(", ")", ")", ")", "{", "cli", ".", "addArguments", "(", "new", "String", "[", "]", "{", "\"-J-Xmx\"", "+", "config", ".", "getMaxmem", "(", ")", "}", ")", ";", "}", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "config", ".", "getMeminitial", "(", ")", ")", ")", "{", "cli", ".", "addArguments", "(", "new", "String", "[", "]", "{", "\"-J-Xms\"", "+", "config", ".", "getMeminitial", "(", ")", "}", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", ",", "e", ")", ";", "}", "CommandLineUtils", ".", "StringStreamConsumer", "out", "=", "new", "CommandLineUtils", ".", "StringStreamConsumer", "(", ")", ";", "CommandLineUtils", ".", "StringStreamConsumer", "err", "=", "new", "CommandLineUtils", ".", "StringStreamConsumer", "(", ")", ";", "int", "returnCode", ";", "List", "<", "CompilerError", ">", "messages", ";", "if", "(", "(", "getLogger", "(", ")", "!=", "null", ")", "&&", "getLogger", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "File", "commandLineFile", "=", "new", "File", "(", "config", ".", "getOutputLocation", "(", ")", ",", "\"greclipse.\"", "+", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", "?", "\"bat\"", ":", "\"sh\"", ")", ")", ";", "try", "{", "FileUtils", ".", "fileWrite", "(", "commandLineFile", ".", "getAbsolutePath", "(", ")", ",", "cli", ".", "toString", "(", ")", ".", "replaceAll", "(", "\"'\"", ",", "\"\"", ")", ")", ";", "if", "(", "!", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", ")", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "new", "String", "[", "]", "{", "\"chmod\"", ",", "\"a+x\"", ",", "commandLineFile", ".", "getAbsolutePath", "(", ")", "}", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "(", "getLogger", "(", ")", "!=", "null", ")", "&&", "getLogger", "(", ")", ".", "isWarnEnabled", "(", ")", ")", "{", "getLogger", "(", ")", ".", "warn", "(", "\"\"", "+", "commandLineFile", ".", "getName", "(", ")", "+", "\"\"", ",", "e", ")", ";", "}", "}", "}", "try", "{", "getLogger", "(", ")", ".", "info", "(", "\"\"", "+", "groovyEclipseLocation", ")", ";", "returnCode", "=", "CommandLineUtils", ".", "executeCommandLine", "(", "cli", ",", "out", ",", "err", ")", ";", "messages", "=", "parseModernStream", "(", "returnCode", ",", "new", "BufferedReader", "(", "new", "StringReader", "(", "err", ".", "getOutput", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "CommandLineException", "e", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", ",", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", ",", "e", ")", ";", "}", "if", "(", "(", "returnCode", "!=", "0", ")", "&&", "messages", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "err", ".", "getOutput", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", "+", "EOL", "+", "cli", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "messages", ".", "add", "(", "new", "CompilerError", "(", "\"\"", "+", "EOL", "+", "err", ".", "getOutput", "(", ")", ",", "true", ")", ")", ";", "}", "}", "return", "messages", ";", "}", "List", "<", "CompilerError", ">", "parseModernStream", "(", "int", "exitCode", ",", "BufferedReader", "input", ")", "throws", "IOException", "{", "List", "<", "CompilerError", ">", "errors", "=", "new", "ArrayList", "<", "CompilerError", ">", "(", ")", ";", "String", "line", ";", "StringBuffer", "buffer", ";", "while", "(", "true", ")", "{", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "do", "{", "line", "=", "input", ".", "readLine", "(", ")", ";", "if", "(", "line", "==", "null", ")", "{", "return", "errors", ";", "}", "if", "(", "(", "buffer", ".", "length", "(", ")", "==", "0", ")", "&&", "line", ".", "startsWith", "(", "\"error:", "\"", ")", ")", "{", "errors", ".", "add", "(", "new", "CompilerError", "(", "line", ",", "true", ")", ")", ";", "}", "else", "if", "(", "(", "buffer", ".", "length", "(", ")", "==", "0", ")", "&&", "isNote", "(", "line", ")", ")", "{", "}", "else", "{", "buffer", ".", "append", "(", "line", ")", ";", "buffer", ".", "append", "(", "EOL", ")", ";", "}", "}", "while", "(", "!", "line", ".", "endsWith", "(", "\"^\"", ")", ")", ";", "errors", ".", "add", "(", "parseModernError", "(", "exitCode", ",", "buffer", ".", "toString", "(", ")", ")", ")", ";", "}", "}", "private", "static", "boolean", "isNote", "(", "String", "line", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "NOTE_PREFIXES", ".", "length", ";", "i", "++", ")", "{", "if", "(", "line", ".", "startsWith", "(", "NOTE_PREFIXES", "[", "i", "]", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "static", "CompilerError", "parseModernError", "(", "int", "exitCode", ",", "String", "error", ")", "{", "StringTokenizer", "tokens", "=", "new", "StringTokenizer", "(", "error", ",", "\":\"", ")", ";", "boolean", "isError", "=", "exitCode", "!=", "0", ";", "StringBuffer", "msgBuffer", ";", "try", "{", "boolean", "tokenIsAnInteger", ";", "String", "previousToken", "=", "null", ";", "String", "currentToken", "=", "null", ";", "do", "{", "previousToken", "=", "currentToken", ";", "currentToken", "=", "tokens", ".", "nextToken", "(", ")", ";", "tokenIsAnInteger", "=", "true", ";", "try", "{", "Integer", ".", "parseInt", "(", "currentToken", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "tokenIsAnInteger", "=", "false", ";", "}", "}", "while", "(", "!", "tokenIsAnInteger", ")", ";", "String", "file", "=", "previousToken", ";", "String", "lineIndicator", "=", "currentToken", ";", "int", "startOfFileName", "=", "previousToken", ".", "lastIndexOf", "(", "\"]\"", ")", ";", "if", "(", "startOfFileName", ">", "-", "1", ")", "{", "file", "=", "file", ".", "substring", "(", "startOfFileName", "+", "2", ")", ";", "}", "if", "(", "file", ".", "length", "(", ")", "==", "1", ")", "{", "file", "=", "new", "StringBuffer", "(", "file", ")", ".", "append", "(", "\":\"", ")", ".", "append", "(", "tokens", ".", "nextToken", "(", ")", ")", ".", "toString", "(", ")", ";", "}", "int", "line", "=", "Integer", ".", "parseInt", "(", "lineIndicator", ")", ";", "msgBuffer", "=", "new", "StringBuffer", "(", ")", ";", "String", "msg", "=", "tokens", ".", "nextToken", "(", "EOL", ")", ".", "substring", "(", "2", ")", ";", "isError", "=", "exitCode", "!=", "0", ";", "String", "warnPrefix", "=", "getWarnPrefix", "(", "msg", ")", ";", "if", "(", "warnPrefix", "!=", "null", ")", "{", "isError", "=", "false", ";", "msg", "=", "msg", ".", "substring", "(", "warnPrefix", ".", "length", "(", ")", ")", ";", "}", "msgBuffer", ".", "append", "(", "msg", ")", ";", "msgBuffer", ".", "append", "(", "EOL", ")", ";", "String", "context", "=", "tokens", ".", "nextToken", "(", "EOL", ")", ";", "String", "pointer", "=", "tokens", ".", "nextToken", "(", "EOL", ")", ";", "if", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "msgBuffer", ".", "append", "(", "context", ")", ";", "msgBuffer", ".", "append", "(", "EOL", ")", ";", "msgBuffer", ".", "append", "(", "pointer", ")", ";", "msgBuffer", ".", "append", "(", "EOL", ")", ";", "context", "=", "tokens", ".", "nextToken", "(", "EOL", ")", ";", "try", "{", "pointer", "=", "tokens", ".", "nextToken", "(", "EOL", ")", ";", "}", "catch", "(", "NoSuchElementException", "e", ")", "{", "pointer", "=", "context", ";", "context", "=", "null", ";", "}", "}", "String", "message", "=", "msgBuffer", ".", "toString", "(", ")", ";", "int", "startcolumn", "=", "pointer", ".", "indexOf", "(", "\"^\"", ")", ";", "int", "endcolumn", "=", "context", "==", "null", "?", "startcolumn", ":", "context", ".", "indexOf", "(", "\"", "\"", ",", "startcolumn", ")", ";", "if", "(", "endcolumn", "==", "-", "1", ")", "{", "endcolumn", "=", "context", ".", "length", "(", ")", ";", "}", "return", "new", "CompilerError", "(", "file", ",", "isError", ",", "line", ",", "startcolumn", ",", "line", ",", "endcolumn", ",", "message", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NoSuchElementException", "e", ")", "{", "return", "new", "CompilerError", "(", "\"\"", "+", "error", ",", "isError", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "new", "CompilerError", "(", "\"\"", "+", "error", ",", "isError", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "new", "CompilerError", "(", "\"\"", "+", "error", ",", "isError", ")", ";", "}", "}", "private", "static", "String", "getWarnPrefix", "(", "String", "msg", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "WARNING_PREFIXES", ".", "length", ";", "i", "++", ")", "{", "if", "(", "msg", ".", "startsWith", "(", "WARNING_PREFIXES", "[", "i", "]", ")", ")", "{", "return", "WARNING_PREFIXES", "[", "i", "]", ";", "}", "}", "return", "null", ";", "}", "private", "File", "createFileWithArguments", "(", "String", "[", "]", "args", ",", "String", "outputDirectory", ")", "throws", "IOException", "{", "PrintWriter", "writer", "=", "null", ";", "try", "{", "File", "tempFile", ";", "if", "(", "(", "getLogger", "(", ")", "!=", "null", ")", "&&", "getLogger", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "tempFile", "=", "File", ".", "createTempFile", "(", "GroovyEclipseCompiler", ".", "class", ".", "getName", "(", ")", ",", "\"arguments\"", ",", "new", "File", "(", "outputDirectory", ")", ")", ";", "}", "else", "{", "tempFile", "=", "File", ".", "createTempFile", "(", "GroovyEclipseCompiler", ".", "class", ".", "getName", "(", ")", ",", "\"arguments\"", ")", ";", "tempFile", ".", "deleteOnExit", "(", ")", ";", "}", "writer", "=", "new", "PrintWriter", "(", "new", "FileWriter", "(", "tempFile", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "String", "argValue", "=", "args", "[", "i", "]", ".", "replace", "(", "File", ".", "separatorChar", ",", "'/'", ")", ";", "writer", ".", "write", "(", "\"\\\"\"", "+", "argValue", "+", "\"\\\"\"", ")", ";", "writer", ".", "println", "(", ")", ";", "}", "writer", ".", "flush", "(", ")", ";", "return", "tempFile", ";", "}", "finally", "{", "if", "(", "writer", "!=", "null", ")", "{", "writer", ".", "close", "(", ")", ";", "}", "}", "}", "private", "String", "getAdditionnalJavaAgentLocation", "(", ")", "throws", "CompilerException", "{", "return", "getClassLocation", "(", "getJavaAgentClass", "(", ")", ")", ";", "}", "private", "String", "getGroovyEclipseBatchLocation", "(", ")", "throws", "CompilerException", "{", "return", "getClassLocation", "(", "Main", ".", "class", ".", "getName", "(", ")", ")", ";", "}", "private", "String", "getClassLocation", "(", "String", "className", ")", "throws", "CompilerException", "{", "Class", "<", "?", ">", "cls", ";", "try", "{", "cls", "=", "Class", ".", "forName", "(", "className", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "CompilerException", "(", "\"\"", "+", "className", "+", "\"\"", ")", ";", "}", "ProtectionDomain", "pDomain", "=", "cls", ".", "getProtectionDomain", "(", ")", ";", "CodeSource", "cSource", "=", "pDomain", ".", "getCodeSource", "(", ")", ";", "if", "(", "cSource", "!=", "null", ")", "{", "URL", "loc", "=", "cSource", ".", "getLocation", "(", ")", ";", "File", "file", ";", "try", "{", "file", "=", "new", "File", "(", "URLDecoder", ".", "decode", "(", "loc", ".", "getPath", "(", ")", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "getLogger", "(", ")", ".", "warn", "(", "\"\"", "+", "loc", ",", "e", ")", ";", "file", "=", "new", "File", "(", "loc", ".", "getPath", "(", ")", ")", ";", "}", "getLogger", "(", ")", ".", "info", "(", "\"\"", "+", "file", ".", "getPath", "(", ")", "+", "\"\"", "+", "className", "+", "\">\"", ")", ";", "return", "file", ".", "getPath", "(", ")", ";", "}", "else", "{", "throw", "new", "CompilerException", "(", "\"\"", "+", "className", "+", "\"\"", ")", ";", "}", "}", "private", "String", "getJavaExecutable", "(", ")", "throws", "IOException", "{", "String", "javaCommand", "=", "\"java\"", "+", "(", "Os", ".", "isFamily", "(", "Os", ".", "FAMILY_WINDOWS", ")", "?", "\".exe\"", ":", "\"\"", ")", ";", "String", "javaHome", "=", "System", ".", "getProperty", "(", "\"java.home\"", ")", ";", "File", "javaExe", ";", "if", "(", "Os", ".", "isName", "(", "\"AIX\"", ")", ")", "{", "javaExe", "=", "new", "File", "(", "javaHome", "+", "File", ".", "separator", "+", "\"..\"", "+", "File", ".", "separator", "+", "\"sh\"", ",", "javaCommand", ")", ";", "}", "else", "if", "(", "Os", ".", "isName", "(", "\"Mac", "OS", "X\"", ")", ")", "{", "javaExe", "=", "new", "File", "(", "javaHome", "+", "File", ".", "separator", "+", "\"bin\"", ",", "javaCommand", ")", ";", "}", "else", "{", "javaExe", "=", "new", "File", "(", "javaHome", "+", "File", ".", "separator", "+", "\"..\"", "+", "File", ".", "separator", "+", "\"bin\"", ",", "javaCommand", ")", ";", "}", "if", "(", "!", "javaExe", ".", "isFile", "(", ")", ")", "{", "Properties", "env", "=", "CommandLineUtils", ".", "getSystemEnvVars", "(", ")", ";", "javaHome", "=", "env", ".", "getProperty", "(", "\"JAVA_HOME\"", ")", ";", "if", "(", "StringUtils", ".", "isEmpty", "(", "javaHome", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "if", "(", "!", "new", "File", "(", "javaHome", ")", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "javaHome", "+", "\"\"", ")", ";", "}", "javaExe", "=", "new", "File", "(", "env", ".", "getProperty", "(", "\"JAVA_HOME\"", ")", "+", "File", ".", "separator", "+", "\"bin\"", ",", "javaCommand", ")", ";", "}", "if", "(", "!", "javaExe", ".", "isFile", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "javaExe", "+", "\"\"", ")", ";", "}", "return", "javaExe", ".", "getAbsolutePath", "(", ")", ";", "}", "public", "String", "getJavaAgentClass", "(", ")", "{", "return", "javaAgentClass", ";", "}", "public", "void", "setJavaAgentClass", "(", "String", "className", ")", "{", "this", ".", "javaAgentClass", "=", "className", ";", "}", "}", "</s>" ]
2,304
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "eclipse", ".", "compiler", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "AbstractMojo", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "MojoExecutionException", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "MojoFailureException", ";", "import", "org", ".", "apache", ".", "maven", ".", "project", ".", "MavenProject", ";", "public", "class", "AddGroovySourceFolders", "extends", "AbstractMojo", "{", "private", "MavenProject", "project", ";", "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "getLog", "(", ")", ".", "info", "(", "\"\"", ")", ";", "this", ".", "project", ".", "addCompileSourceRoot", "(", "project", ".", "getBasedir", "(", ")", "+", "\"\"", ")", ";", "getLog", "(", ")", ".", "info", "(", "\"\"", ")", ";", "this", ".", "project", ".", "addTestCompileSourceRoot", "(", "project", ".", "getBasedir", "(", ")", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
2,305
[ "<s>", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "Assert", ";", "public", "class", "JavaTest", "{", "@", "Test", "public", "void", "testMethod", "(", ")", "{", "JavaMain", ".", "main", "(", "new", "String", "[", "]", "{", "}", ")", ";", "Assert", ".", "assertTrue", "(", "true", ")", ";", "}", "}", "</s>" ]
2,306
[ "<s>", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "junit", ".", "Assert", ";", "public", "class", "JavaTest", "{", "@", "Test", "public", "void", "testMethod", "(", ")", "{", "JavaMain", ".", "main", "(", "null", ")", ";", "Assert", ".", "assertTrue", "(", "true", ")", ";", "}", "}", "</s>" ]
2,307
[ "<s>", "public", "class", "JavaMain", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "new", "JavaHello", "(", ")", ".", "sayHello", "(", ")", ";", "}", "}", "</s>" ]
2,308
[ "<s>", "interface", "Helloable", "{", "void", "sayHello", "(", ")", ";", "}", "</s>" ]
2,309
[ "<s>", "class", "JavaHello", "implements", "Helloable", "{", "public", "void", "sayHello", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
2,310
[ "<s>", "public", "class", "JavaMain", "{", "public", "static", "void", "main", "(", "String", "...", "args", ")", "{", "new", "GroovyHello", "(", ")", ".", "sayHello", "(", ")", ";", "new", "JavaHello", "(", ")", ".", "sayHello", "(", ")", ";", "}", "}", "</s>" ]
2,311
[ "<s>", "public", "class", "JavaHello", "implements", "Helloable", "{", "public", "void", "sayHello", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
2,312
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "eclipse", ".", "maven", ".", "testing", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "HelperTest", "extends", "TestCase", "{", "public", "void", "testHelper", "(", ")", "throws", "Exception", "{", "new", "Helper", "(", ")", ".", "help", "(", "new", "Example", "(", ")", ")", ";", "}", "}", "</s>" ]
2,313
[ "<s>", "package", "org", ".", "codehaus", ".", "groovy", ".", "eclipse", ".", "maven", ".", "testing", ";", "public", "class", "JavaClass", "{", "Example", "e", ";", "Helper", "h", ";", "private", "int", "unused", ";", "}", "</s>" ]
2,314
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "public", "abstract", "class", "RewriteEvent", "{", "public", "static", "final", "int", "INSERTED", "=", "1", ";", "public", "static", "final", "int", "REMOVED", "=", "2", ";", "public", "static", "final", "int", "REPLACED", "=", "4", ";", "public", "static", "final", "int", "CHILDREN_CHANGED", "=", "8", ";", "public", "static", "final", "int", "UNCHANGED", "=", "0", ";", "public", "abstract", "int", "getChangeKind", "(", ")", ";", "public", "abstract", "boolean", "isListRewrite", "(", ")", ";", "public", "abstract", "Object", "getOriginalValue", "(", ")", ";", "public", "abstract", "Object", "getNewValue", "(", ")", ";", "public", "abstract", "RewriteEvent", "[", "]", "getChildren", "(", ")", ";", "}", "</s>" ]
2,315
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ITrackedNodePosition", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IRegion", ";", "public", "class", "TrackedNodePosition", "implements", "ITrackedNodePosition", "{", "private", "final", "TextEditGroup", "group", ";", "private", "final", "ASTNode", "node", ";", "public", "TrackedNodePosition", "(", "TextEditGroup", "group", ",", "ASTNode", "node", ")", "{", "this", ".", "group", "=", "group", ";", "this", ".", "node", "=", "node", ";", "}", "public", "int", "getStartPosition", "(", ")", "{", "if", "(", "this", ".", "group", ".", "isEmpty", "(", ")", ")", "{", "return", "this", ".", "node", ".", "getStartPosition", "(", ")", ";", "}", "IRegion", "coverage", "=", "TextEdit", ".", "getCoverage", "(", "this", ".", "group", ".", "getTextEdits", "(", ")", ")", ";", "if", "(", "coverage", "==", "null", ")", "{", "return", "this", ".", "node", ".", "getStartPosition", "(", ")", ";", "}", "return", "coverage", ".", "getOffset", "(", ")", ";", "}", "public", "int", "getLength", "(", ")", "{", "if", "(", "this", ".", "group", ".", "isEmpty", "(", ")", ")", "{", "return", "this", ".", "node", ".", "getLength", "(", ")", ";", "}", "IRegion", "coverage", "=", "TextEdit", ".", "getCoverage", "(", "this", ".", "group", ".", "getTextEdits", "(", ")", ")", ";", "if", "(", "coverage", "==", "null", ")", "{", "return", "this", ".", "node", ".", "getLength", "(", ")", ";", "}", "return", "coverage", ".", "getLength", "(", ")", ";", "}", "}", "</s>" ]
2,316
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "IndentManipulation", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "ISourceModifier", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "ReplaceEdit", ";", "public", "class", "SourceModifier", "implements", "ISourceModifier", "{", "private", "final", "String", "destinationIndent", ";", "private", "final", "int", "sourceIndentLevel", ";", "private", "final", "int", "tabWidth", ";", "private", "final", "int", "indentWidth", ";", "public", "SourceModifier", "(", "int", "sourceIndentLevel", ",", "String", "destinationIndent", ",", "int", "tabWidth", ",", "int", "indentWidth", ")", "{", "this", ".", "destinationIndent", "=", "destinationIndent", ";", "this", ".", "sourceIndentLevel", "=", "sourceIndentLevel", ";", "this", ".", "tabWidth", "=", "tabWidth", ";", "this", ".", "indentWidth", "=", "indentWidth", ";", "}", "public", "ISourceModifier", "copy", "(", ")", "{", "return", "this", ";", "}", "public", "ReplaceEdit", "[", "]", "getModifications", "(", "String", "source", ")", "{", "List", "result", "=", "new", "ArrayList", "(", ")", ";", "int", "destIndentLevel", "=", "IndentManipulation", ".", "measureIndentUnits", "(", "this", ".", "destinationIndent", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ")", ";", "if", "(", "destIndentLevel", "==", "this", ".", "sourceIndentLevel", ")", "{", "return", "(", "ReplaceEdit", "[", "]", ")", "result", ".", "toArray", "(", "new", "ReplaceEdit", "[", "result", ".", "size", "(", ")", "]", ")", ";", "}", "return", "IndentManipulation", ".", "getChangeIndentEdits", "(", "source", ",", "this", ".", "sourceIndentLevel", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ",", "this", ".", "destinationIndent", ")", ";", "}", "}", "</s>" ]
2,317
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "public", "class", "ASTRewriteFlattener", "extends", "ASTVisitor", "{", "static", "final", "int", "JLS2_INTERNAL", "=", "AST", ".", "JLS2", ";", "static", "final", "int", "JLS3_INTERNAL", "=", "AST", ".", "JLS3", ";", "public", "static", "String", "asString", "(", "ASTNode", "node", ",", "RewriteEventStore", "store", ")", "{", "ASTRewriteFlattener", "flattener", "=", "new", "ASTRewriteFlattener", "(", "store", ")", ";", "node", ".", "accept", "(", "flattener", ")", ";", "return", "flattener", ".", "getResult", "(", ")", ";", "}", "protected", "StringBuffer", "result", ";", "private", "RewriteEventStore", "store", ";", "public", "ASTRewriteFlattener", "(", "RewriteEventStore", "store", ")", "{", "this", ".", "store", "=", "store", ";", "this", ".", "result", "=", "new", "StringBuffer", "(", ")", ";", "}", "public", "String", "getResult", "(", ")", "{", "return", "new", "String", "(", "this", ".", "result", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "reset", "(", ")", "{", "this", ".", "result", ".", "setLength", "(", "0", ")", ";", "}", "public", "static", "void", "printModifiers", "(", "int", "modifiers", ",", "StringBuffer", "buf", ")", "{", "if", "(", "Modifier", ".", "isPublic", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"public", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isProtected", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"protected", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isPrivate", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"private", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isStatic", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"static", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isAbstract", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"abstract", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isFinal", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"final", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isSynchronized", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "Modifier", ".", "isVolatile", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"volatile", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isNative", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"native", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isStrictfp", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"strictfp", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isTransient", "(", "modifiers", ")", ")", "{", "buf", ".", "append", "(", "\"transient", "\"", ")", ";", "}", "}", "protected", "List", "getChildList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "return", "(", "List", ")", "getAttribute", "(", "parent", ",", "childProperty", ")", ";", "}", "protected", "ASTNode", "getChildNode", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "return", "(", "ASTNode", ")", "getAttribute", "(", "parent", ",", "childProperty", ")", ";", "}", "protected", "int", "getIntAttribute", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "return", "(", "(", "Integer", ")", "getAttribute", "(", "parent", ",", "childProperty", ")", ")", ".", "intValue", "(", ")", ";", "}", "protected", "boolean", "getBooleanAttribute", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "return", "(", "(", "Boolean", ")", "getAttribute", "(", "parent", ",", "childProperty", ")", ")", ".", "booleanValue", "(", ")", ";", "}", "protected", "Object", "getAttribute", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "return", "this", ".", "store", ".", "getNewValue", "(", "parent", ",", "childProperty", ")", ";", "}", "protected", "void", "visitList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "String", "separator", ")", "{", "List", "list", "=", "getChildList", "(", "parent", ",", "childProperty", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "separator", "!=", "null", "&&", "i", ">", "0", ")", "{", "this", ".", "result", ".", "append", "(", "separator", ")", ";", "}", "(", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ")", ".", "accept", "(", "this", ")", ";", "}", "}", "protected", "void", "visitList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "String", "separator", ",", "String", "lead", ",", "String", "post", ")", "{", "List", "list", "=", "getChildList", "(", "parent", ",", "childProperty", ")", ";", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "result", ".", "append", "(", "lead", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "separator", "!=", "null", "&&", "i", ">", "0", ")", "{", "this", ".", "result", ".", "append", "(", "separator", ")", ";", "}", "(", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "post", ")", ";", "}", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "AnonymousClassDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "null", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayAccess", "node", ")", "{", "getChildNode", "(", "node", ",", "ArrayAccess", ".", "ARRAY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'['", ")", ";", "getChildNode", "(", "node", ",", "ArrayAccess", ".", "INDEX_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "']'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayCreation", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"new", "\"", ")", ";", "ArrayType", "arrayType", "=", "(", "ArrayType", ")", "getChildNode", "(", "node", ",", "ArrayCreation", ".", "TYPE_PROPERTY", ")", ";", "Type", "elementType", "=", "(", "Type", ")", "getChildNode", "(", "arrayType", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "int", "dimensions", "=", "1", ";", "while", "(", "elementType", ".", "isArrayType", "(", ")", ")", "{", "dimensions", "++", ";", "elementType", "=", "(", "Type", ")", "getChildNode", "(", "elementType", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "}", "elementType", ".", "accept", "(", "this", ")", ";", "List", "list", "=", "getChildList", "(", "node", ",", "ArrayCreation", ".", "DIMENSIONS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "'['", ")", ";", "(", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "']'", ")", ";", "dimensions", "--", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dimensions", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "\"[]\"", ")", ";", "}", "ASTNode", "initializer", "=", "getChildNode", "(", "node", ",", "ArrayCreation", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "getChildNode", "(", "node", ",", "ArrayCreation", ".", "INITIALIZER_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayInitializer", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "ArrayInitializer", ".", "EXPRESSIONS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayType", "node", ")", "{", "getChildNode", "(", "node", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\"[]\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AssertStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"assert", "\"", ")", ";", "getChildNode", "(", "node", ",", "AssertStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "ASTNode", "message", "=", "getChildNode", "(", "node", ",", "AssertStatement", ".", "MESSAGE_PROPERTY", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "':'", ")", ";", "message", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Assignment", "node", ")", "{", "getChildNode", "(", "node", ",", "Assignment", ".", "LEFT_HAND_SIDE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "Assignment", ".", "OPERATOR_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "getChildNode", "(", "node", ",", "Assignment", ".", "RIGHT_HAND_SIDE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Block", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "Block", ".", "STATEMENTS_PROPERTY", ",", "null", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BooleanLiteral", "node", ")", "{", "if", "(", "node", ".", "booleanValue", "(", ")", "==", "true", ")", "{", "this", ".", "result", ".", "append", "(", "\"true\"", ")", ";", "}", "else", "{", "this", ".", "result", ".", "append", "(", "\"false\"", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BreakStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"break\"", ")", ";", "ASTNode", "label", "=", "getChildNode", "(", "node", ",", "BreakStatement", ".", "LABEL_PROPERTY", ")", ";", "if", "(", "label", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "label", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CastExpression", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "getChildNode", "(", "node", ",", "CastExpression", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "CastExpression", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CatchClause", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"catch", "(\"", ")", ";", "getChildNode", "(", "node", ",", "CatchClause", ".", "EXCEPTION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "CatchClause", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CharacterLiteral", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "CharacterLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ClassInstanceCreation", "node", ")", "{", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "ClassInstanceCreation", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "expression", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"new", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "getChildNode", "(", "node", ",", "ClassInstanceCreation", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "getChildNode", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "ClassInstanceCreation", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "ASTNode", "decl", "=", "getChildNode", "(", "node", ",", "ClassInstanceCreation", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "if", "(", "decl", "!=", "null", ")", "{", "decl", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CompilationUnit", "node", ")", "{", "ASTNode", "pack", "=", "getChildNode", "(", "node", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ")", ";", "if", "(", "pack", "!=", "null", ")", "{", "pack", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "CompilationUnit", ".", "IMPORTS_PROPERTY", ",", "null", ")", ";", "visitList", "(", "node", ",", "CompilationUnit", ".", "TYPES_PROPERTY", ",", "null", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConditionalExpression", "node", ")", "{", "getChildNode", "(", "node", ",", "ConditionalExpression", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'?'", ")", ";", "getChildNode", "(", "node", ",", "ConditionalExpression", ".", "THEN_EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "':'", ")", ";", "getChildNode", "(", "node", ",", "ConditionalExpression", ".", "ELSE_EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConstructorInvocation", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "visitList", "(", "node", ",", "ConstructorInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"this(\"", ")", ";", "visitList", "(", "node", ",", "ConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "\");\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ContinueStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"continue\"", ")", ";", "ASTNode", "label", "=", "getChildNode", "(", "node", ",", "ContinueStatement", ".", "LABEL_PROPERTY", ")", ";", "if", "(", "label", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "label", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "DoStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"do", "\"", ")", ";", "getChildNode", "(", "node", ",", "DoStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\"", "while", "(\"", ")", ";", "getChildNode", "(", "node", ",", "DoStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\");\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EmptyStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ExpressionStatement", "node", ")", "{", "getChildNode", "(", "node", ",", "ExpressionStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldAccess", "node", ")", "{", "getChildNode", "(", "node", ",", "FieldAccess", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "getChildNode", "(", "node", ",", "FieldAccess", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "FieldDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "FieldDeclaration", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "FieldDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "FieldDeclaration", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "visitList", "(", "node", ",", "FieldDeclaration", ".", "FRAGMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ForStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"for", "(\"", ")", ";", "visitList", "(", "node", ",", "ForStatement", ".", "INITIALIZERS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "ForStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "expression", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "visitList", "(", "node", ",", "ForStatement", ".", "UPDATERS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "ForStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "IfStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"if", "(\"", ")", ";", "getChildNode", "(", "node", ",", "IfStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "ASTNode", "elseStatement", "=", "getChildNode", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ")", ";", "if", "(", "elseStatement", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "\"", "else", "\"", ")", ";", "elseStatement", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ImportDeclaration", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"import", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "getBooleanAttribute", "(", "node", ",", "ImportDeclaration", ".", "STATIC_PROPERTY", ")", ")", "{", "this", ".", "result", ".", "append", "(", "\"static", "\"", ")", ";", "}", "}", "getChildNode", "(", "node", ",", "ImportDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "getBooleanAttribute", "(", "node", ",", "ImportDeclaration", ".", "ON_DEMAND_PROPERTY", ")", ")", "{", "this", ".", "result", ".", "append", "(", "\".*\"", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InfixExpression", "node", ")", "{", "getChildNode", "(", "node", ",", "InfixExpression", ".", "LEFT_OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "String", "operator", "=", "getAttribute", "(", "node", ",", "InfixExpression", ".", "OPERATOR_PROPERTY", ")", ".", "toString", "(", ")", ";", "this", ".", "result", ".", "append", "(", "operator", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "getChildNode", "(", "node", ",", "InfixExpression", ".", "RIGHT_OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "List", "list", "=", "getChildList", "(", "node", ",", "InfixExpression", ".", "EXTENDED_OPERANDS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "operator", ")", ";", "(", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InstanceofExpression", "node", ")", "{", "getChildNode", "(", "node", ",", "InstanceofExpression", ".", "LEFT_OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\"", "instanceof", "\"", ")", ";", "getChildNode", "(", "node", ",", "InstanceofExpression", ".", "RIGHT_OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Initializer", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "Initializer", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "Initializer", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "Initializer", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "Initializer", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Javadoc", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"/**\"", ")", ";", "List", "list", "=", "getChildList", "(", "node", ",", "Javadoc", ".", "TAGS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "\"n", "*", "\"", ")", ";", "(", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"n", "*/\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "LabeledStatement", "node", ")", "{", "getChildNode", "(", "node", ",", "LabeledStatement", ".", "LABEL_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\":", "\"", ")", ";", "getChildNode", "(", "node", ",", "LabeledStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "MethodDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "MethodDeclaration", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "MethodDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "visitList", "(", "node", ",", "MethodDeclaration", ".", "TYPE_PARAMETERS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "if", "(", "!", "getBooleanAttribute", "(", "node", ",", "MethodDeclaration", ".", "CONSTRUCTOR_PROPERTY", ")", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "getChildNode", "(", "node", ",", "MethodDeclaration", ".", "RETURN_TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "ASTNode", "returnType", "=", "getChildNode", "(", "node", ",", "MethodDeclaration", ".", "RETURN_TYPE2_PROPERTY", ")", ";", "if", "(", "returnType", "!=", "null", ")", "{", "returnType", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "this", ".", "result", ".", "append", "(", "\"void\"", ")", ";", "}", "}", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "}", "getChildNode", "(", "node", ",", "MethodDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "MethodDeclaration", ".", "PARAMETERS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "int", "extraDims", "=", "getIntAttribute", "(", "node", ",", "MethodDeclaration", ".", "EXTRA_DIMENSIONS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extraDims", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "\"[]\"", ")", ";", "}", "visitList", "(", "node", ",", "MethodDeclaration", ".", "THROWN_EXCEPTIONS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "\"", "throws", "\"", ",", "Util", ".", "EMPTY_STRING", ")", ";", "ASTNode", "body", "=", "getChildNode", "(", "node", ",", "MethodDeclaration", ".", "BODY_PROPERTY", ")", ";", "if", "(", "body", "==", "null", ")", "{", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "}", "else", "{", "body", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodInvocation", "node", ")", "{", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "MethodInvocation", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "expression", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "visitList", "(", "node", ",", "MethodInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "MethodInvocation", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "MethodInvocation", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NullLiteral", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"null\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NumberLiteral", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "NumberLiteral", ".", "TOKEN_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PackageDeclaration", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "PackageDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "PackageDeclaration", ".", "ANNOTATIONS_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"package", "\"", ")", ";", "getChildNode", "(", "node", ",", "PackageDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParenthesizedExpression", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "getChildNode", "(", "node", ",", "ParenthesizedExpression", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PostfixExpression", "node", ")", "{", "getChildNode", "(", "node", ",", "PostfixExpression", ".", "OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "PostfixExpression", ".", "OPERATOR_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrefixExpression", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "PrefixExpression", ".", "OPERATOR_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "getChildNode", "(", "node", ",", "PrefixExpression", ".", "OPERAND_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrimitiveType", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "PrimitiveType", ".", "PRIMITIVE_TYPE_CODE_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedName", "node", ")", "{", "getChildNode", "(", "node", ",", "QualifiedName", ".", "QUALIFIER_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "getChildNode", "(", "node", ",", "QualifiedName", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ReturnStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"return\"", ")", ";", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "ReturnStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "expression", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleName", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "SimpleName", ".", "IDENTIFIER_PROPERTY", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SingleVariableDeclaration", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "SingleVariableDeclaration", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "SingleVariableDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "SingleVariableDeclaration", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "getBooleanAttribute", "(", "node", ",", "SingleVariableDeclaration", ".", "VARARGS_PROPERTY", ")", ")", "{", "this", ".", "result", ".", "append", "(", "\"...\"", ")", ";", "}", "}", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "getChildNode", "(", "node", ",", "SingleVariableDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "int", "extraDimensions", "=", "getIntAttribute", "(", "node", ",", "SingleVariableDeclaration", ".", "EXTRA_DIMENSIONS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extraDimensions", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "\"[]\"", ")", ";", "}", "ASTNode", "initializer", "=", "getChildNode", "(", "node", ",", "SingleVariableDeclaration", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'='", ")", ";", "initializer", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "StringLiteral", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "StringLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperConstructorInvocation", "node", ")", "{", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "SuperConstructorInvocation", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "expression", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "visitList", "(", "node", ",", "SuperConstructorInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"super(\"", ")", ";", "visitList", "(", "node", ",", "SuperConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "\");\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperFieldAccess", "node", ")", "{", "ASTNode", "qualifier", "=", "getChildNode", "(", "node", ",", "SuperFieldAccess", ".", "QUALIFIER_PROPERTY", ")", ";", "if", "(", "qualifier", "!=", "null", ")", "{", "qualifier", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"super.\"", ")", ";", "getChildNode", "(", "node", ",", "SuperFieldAccess", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperMethodInvocation", "node", ")", "{", "ASTNode", "qualifier", "=", "getChildNode", "(", "node", ",", "SuperMethodInvocation", ".", "QUALIFIER_PROPERTY", ")", ";", "if", "(", "qualifier", "!=", "null", ")", "{", "qualifier", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"super.\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "visitList", "(", "node", ",", "SuperMethodInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "SuperMethodInvocation", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "SuperMethodInvocation", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SwitchCase", "node", ")", "{", "ASTNode", "expression", "=", "getChildNode", "(", "node", ",", "SwitchCase", ".", "EXPRESSION_PROPERTY", ")", ";", "if", "(", "expression", "==", "null", ")", "{", "this", ".", "result", ".", "append", "(", "\"default\"", ")", ";", "}", "else", "{", "this", ".", "result", ".", "append", "(", "\"case", "\"", ")", ";", "expression", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "':'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SwitchStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"switch", "(\"", ")", ";", "getChildNode", "(", "node", ",", "SwitchStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "SwitchStatement", ".", "STATEMENTS_PROPERTY", ",", "null", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SynchronizedStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"\"", ")", ";", "getChildNode", "(", "node", ",", "SynchronizedStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "SynchronizedStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThisExpression", "node", ")", "{", "ASTNode", "qualifier", "=", "getChildNode", "(", "node", ",", "ThisExpression", ".", "QUALIFIER_PROPERTY", ")", ";", "if", "(", "qualifier", "!=", "null", ")", "{", "qualifier", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "}", "this", ".", "result", ".", "append", "(", "\"this\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThrowStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"throw", "\"", ")", ";", "getChildNode", "(", "node", ",", "ThrowStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TryStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"try", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "AST", ".", "JLS4", ")", "{", "visitList", "(", "node", ",", "TryStatement", ".", "RESOURCES_PROPERTY", ",", "String", ".", "valueOf", "(", "';'", ")", ",", "String", ".", "valueOf", "(", "'('", ")", ",", "String", ".", "valueOf", "(", "')'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "TryStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "visitList", "(", "node", ",", "TryStatement", ".", "CATCH_CLAUSES_PROPERTY", ",", "null", ")", ";", "ASTNode", "finallyClause", "=", "getChildNode", "(", "node", ",", "TryStatement", ".", "FINALLY_PROPERTY", ")", ";", "if", "(", "finallyClause", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "\"", "finally", "\"", ")", ";", "finallyClause", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "node", ")", "{", "int", "apiLevel", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ";", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "TypeDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "apiLevel", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "TypeDeclaration", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "TypeDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "boolean", "isInterface", "=", "getBooleanAttribute", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ";", "this", ".", "result", ".", "append", "(", "isInterface", "?", "\"interface", "\"", ":", "\"class", "\"", ")", ";", "getChildNode", "(", "node", ",", "TypeDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "apiLevel", ">=", "JLS3_INTERNAL", ")", "{", "visitList", "(", "node", ",", "TypeDeclaration", ".", "TYPE_PARAMETERS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "String", ".", "valueOf", "(", "'>'", ")", ")", ";", "}", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "ChildPropertyDescriptor", "superClassProperty", "=", "(", "apiLevel", "==", "JLS2_INTERNAL", ")", "?", "TypeDeclaration", ".", "SUPERCLASS_PROPERTY", ":", "TypeDeclaration", ".", "SUPERCLASS_TYPE_PROPERTY", ";", "ASTNode", "superclass", "=", "getChildNode", "(", "node", ",", "superClassProperty", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "\"extends", "\"", ")", ";", "superclass", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "}", "ChildListPropertyDescriptor", "superInterfaceProperty", "=", "(", "apiLevel", "==", "JLS2_INTERNAL", ")", "?", "TypeDeclaration", ".", "SUPER_INTERFACES_PROPERTY", ":", "TypeDeclaration", ".", "SUPER_INTERFACE_TYPES_PROPERTY", ";", "String", "lead", "=", "isInterface", "?", "\"extends", "\"", ":", "\"implements", "\"", ";", "visitList", "(", "node", ",", "superInterfaceProperty", ",", "String", ".", "valueOf", "(", "','", ")", ",", "lead", ",", "Util", ".", "EMPTY_STRING", ")", ";", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "TypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "null", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclarationStatement", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "getChildNode", "(", "node", ",", "TypeDeclarationStatement", ".", "TYPE_DECLARATION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "getChildNode", "(", "node", ",", "TypeDeclarationStatement", ".", "DECLARATION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeLiteral", "node", ")", "{", "getChildNode", "(", "node", ",", "TypeLiteral", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\".class\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "UnionType", "node", ")", "{", "visitList", "(", "node", ",", "UnionType", ".", "TYPES_PROPERTY", ",", "\"", "|", "\"", ",", "Util", ".", "EMPTY_STRING", ",", "Util", ".", "EMPTY_STRING", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationExpression", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "VariableDeclarationExpression", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "VariableDeclarationExpression", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "VariableDeclarationExpression", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "visitList", "(", "node", ",", "VariableDeclarationExpression", ".", "FRAGMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationFragment", "node", ")", "{", "getChildNode", "(", "node", ",", "VariableDeclarationFragment", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "int", "extraDimensions", "=", "getIntAttribute", "(", "node", ",", "VariableDeclarationFragment", ".", "EXTRA_DIMENSIONS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extraDimensions", ";", "i", "++", ")", "{", "this", ".", "result", ".", "append", "(", "\"[]\"", ")", ";", "}", "ASTNode", "initializer", "=", "getChildNode", "(", "node", ",", "VariableDeclarationFragment", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'='", ")", ";", "initializer", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationStatement", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "printModifiers", "(", "getIntAttribute", "(", "node", ",", "VariableDeclarationStatement", ".", "MODIFIERS_PROPERTY", ")", ",", "this", ".", "result", ")", ";", "}", "else", "{", "visitList", "(", "node", ",", "VariableDeclarationStatement", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "}", "getChildNode", "(", "node", ",", "VariableDeclarationStatement", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "visitList", "(", "node", ",", "VariableDeclarationStatement", ".", "FRAGMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ")", ";", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WhileStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"while", "(\"", ")", ";", "getChildNode", "(", "node", ",", "WhileStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "WhileStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BlockComment", "node", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "LineComment", "node", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberRef", "node", ")", "{", "ASTNode", "qualifier", "=", "getChildNode", "(", "node", ",", "MemberRef", ".", "QUALIFIER_PROPERTY", ")", ";", "if", "(", "qualifier", "!=", "null", ")", "{", "qualifier", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "'#'", ")", ";", "getChildNode", "(", "node", ",", "MemberRef", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRef", "node", ")", "{", "ASTNode", "qualifier", "=", "getChildNode", "(", "node", ",", "MethodRef", ".", "QUALIFIER_PROPERTY", ")", ";", "if", "(", "qualifier", "!=", "null", ")", "{", "qualifier", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "'#'", ")", ";", "getChildNode", "(", "node", ",", "MethodRef", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "MethodRef", ".", "PARAMETERS_PROPERTY", ",", "\",\"", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRefParameter", "node", ")", "{", "getChildNode", "(", "node", ",", "MethodRefParameter", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "getBooleanAttribute", "(", "node", ",", "MethodRefParameter", ".", "VARARGS_PROPERTY", ")", ")", "{", "this", ".", "result", ".", "append", "(", "\"...\"", ")", ";", "}", "}", "ASTNode", "name", "=", "getChildNode", "(", "node", ",", "MethodRefParameter", ".", "NAME_PROPERTY", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "name", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TagElement", "node", ")", "{", "Object", "tagName", "=", "getAttribute", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ";", "if", "(", "tagName", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "(", "String", ")", "tagName", ")", ";", "}", "List", "list", "=", "getChildList", "(", "node", ",", "TagElement", ".", "FRAGMENTS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", "||", "tagName", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "}", "ASTNode", "curr", "=", "(", "ASTNode", ")", "list", ".", "get", "(", "i", ")", ";", "if", "(", "curr", "instanceof", "TagElement", ")", "{", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "curr", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "}", "else", "{", "curr", ".", "accept", "(", "this", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TextElement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "TextElement", ".", "TEXT_PROPERTY", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "AnnotationTypeDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "AnnotationTypeDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "this", ".", "result", ".", "append", "(", "\"@interface", "\"", ")", ";", "getChildNode", "(", "node", ",", "AnnotationTypeDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "AnnotationTypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "Util", ".", "EMPTY_STRING", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeMemberDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "getChildNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "getChildNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "\"()\"", ")", ";", "ASTNode", "def", "=", "getChildNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "DEFAULT_PROPERTY", ")", ";", "if", "(", "def", "!=", "null", ")", "{", "this", ".", "result", ".", "append", "(", "\"", "default", "\"", ")", ";", "def", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "result", ".", "append", "(", "';'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnhancedForStatement", "node", ")", "{", "this", ".", "result", ".", "append", "(", "\"for", "(\"", ")", ";", "getChildNode", "(", "node", ",", "EnhancedForStatement", ".", "PARAMETER_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "':'", ")", ";", "getChildNode", "(", "node", ",", "EnhancedForStatement", ".", "EXPRESSION_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "getChildNode", "(", "node", ",", "EnhancedForStatement", ".", "BODY_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumConstantDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "EnumConstantDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "EnumConstantDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "getChildNode", "(", "node", ",", "EnumConstantDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "visitList", "(", "node", ",", "EnumConstantDeclaration", ".", "ARGUMENTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "String", ".", "valueOf", "(", "'('", ")", ",", "String", ".", "valueOf", "(", "')'", ")", ")", ";", "ASTNode", "classDecl", "=", "getChildNode", "(", "node", ",", "EnumConstantDeclaration", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "if", "(", "classDecl", "!=", "null", ")", "{", "classDecl", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "node", ")", "{", "ASTNode", "javadoc", "=", "getChildNode", "(", "node", ",", "EnumDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "javadoc", ".", "accept", "(", "this", ")", ";", "}", "visitList", "(", "node", ",", "EnumDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "'", "'", ")", ")", ";", "this", ".", "result", ".", "append", "(", "\"enum", "\"", ")", ";", "getChildNode", "(", "node", ",", "EnumDeclaration", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'", "'", ")", ";", "visitList", "(", "node", ",", "EnumDeclaration", ".", "SUPER_INTERFACE_TYPES_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "\"implements", "\"", ",", "Util", ".", "EMPTY_STRING", ")", ";", "this", ".", "result", ".", "append", "(", "'{'", ")", ";", "visitList", "(", "node", ",", "EnumDeclaration", ".", "ENUM_CONSTANTS_PROPERTY", ",", "String", ".", "valueOf", "(", "','", ")", ",", "Util", ".", "EMPTY_STRING", ",", "Util", ".", "EMPTY_STRING", ")", ";", "visitList", "(", "node", ",", "EnumDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "Util", ".", "EMPTY_STRING", ",", "String", ".", "valueOf", "(", "';'", ")", ",", "Util", ".", "EMPTY_STRING", ")", ";", "this", ".", "result", ".", "append", "(", "'}'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MarkerAnnotation", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'@'", ")", ";", "getChildNode", "(", "node", ",", "MarkerAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberValuePair", "node", ")", "{", "getChildNode", "(", "node", ",", "MemberValuePair", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'='", ")", ";", "getChildNode", "(", "node", ",", "MemberValuePair", ".", "VALUE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Modifier", "node", ")", "{", "this", ".", "result", ".", "append", "(", "getAttribute", "(", "node", ",", "Modifier", ".", "KEYWORD_PROPERTY", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NormalAnnotation", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'@'", ")", ";", "getChildNode", "(", "node", ",", "NormalAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "visitList", "(", "node", ",", "NormalAnnotation", ".", "VALUES_PROPERTY", ",", "\",", "\"", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParameterizedType", "node", ")", "{", "getChildNode", "(", "node", ",", "ParameterizedType", ".", "TYPE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'<'", ")", ";", "visitList", "(", "node", ",", "ParameterizedType", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "\",", "\"", ")", ";", "this", ".", "result", ".", "append", "(", "'>'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedType", "node", ")", "{", "getChildNode", "(", "node", ",", "QualifiedType", ".", "QUALIFIER_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'.'", ")", ";", "getChildNode", "(", "node", ",", "QualifiedType", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleMemberAnnotation", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'@'", ")", ";", "getChildNode", "(", "node", ",", "SingleMemberAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "'('", ")", ";", "getChildNode", "(", "node", ",", "SingleMemberAnnotation", ".", "VALUE_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "result", ".", "append", "(", "')'", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeParameter", "node", ")", "{", "getChildNode", "(", "node", ",", "TypeParameter", ".", "NAME_PROPERTY", ")", ".", "accept", "(", "this", ")", ";", "visitList", "(", "node", ",", "TypeParameter", ".", "TYPE_BOUNDS_PROPERTY", ",", "\"", "&", "\"", ",", "\"", "extends", "\"", ",", "Util", ".", "EMPTY_STRING", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WildcardType", "node", ")", "{", "this", ".", "result", ".", "append", "(", "'?'", ")", ";", "ASTNode", "bound", "=", "getChildNode", "(", "node", ",", "WildcardType", ".", "BOUND_PROPERTY", ")", ";", "if", "(", "bound", "!=", "null", ")", "{", "if", "(", "getBooleanAttribute", "(", "node", ",", "WildcardType", ".", "UPPER_BOUND_PROPERTY", ")", ")", "{", "this", ".", "result", ".", "append", "(", "\"", "extends", "\"", ")", ";", "}", "else", "{", "this", ".", "result", ".", "append", "(", "\"", "super", "\"", ")", ";", "}", "bound", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
2,318
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "LineComment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "IndentManipulation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "public", "class", "LineCommentEndOffsets", "{", "private", "int", "[", "]", "offsets", ";", "private", "final", "List", "commentList", ";", "public", "LineCommentEndOffsets", "(", "List", "commentList", ")", "{", "this", ".", "commentList", "=", "commentList", ";", "this", ".", "offsets", "=", "null", ";", "}", "private", "int", "[", "]", "getOffsets", "(", ")", "{", "if", "(", "this", ".", "offsets", "==", "null", ")", "{", "if", "(", "this", ".", "commentList", "!=", "null", ")", "{", "int", "nComments", "=", "this", ".", "commentList", ".", "size", "(", ")", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nComments", ";", "i", "++", ")", "{", "Object", "curr", "=", "this", ".", "commentList", ".", "get", "(", "i", ")", ";", "if", "(", "curr", "instanceof", "LineComment", ")", "{", "count", "++", ";", "}", "}", "this", ".", "offsets", "=", "new", "int", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ",", "k", "=", "0", ";", "i", "<", "nComments", ";", "i", "++", ")", "{", "Object", "curr", "=", "this", ".", "commentList", ".", "get", "(", "i", ")", ";", "if", "(", "curr", "instanceof", "LineComment", ")", "{", "LineComment", "comment", "=", "(", "LineComment", ")", "curr", ";", "this", ".", "offsets", "[", "k", "++", "]", "=", "comment", ".", "getStartPosition", "(", ")", "+", "comment", ".", "getLength", "(", ")", ";", "}", "}", "}", "else", "{", "this", ".", "offsets", "=", "Util", ".", "EMPTY_INT_ARRAY", ";", "}", "}", "return", "this", ".", "offsets", ";", "}", "public", "boolean", "isEndOfLineComment", "(", "int", "offset", ")", "{", "return", "offset", ">=", "0", "&&", "Arrays", ".", "binarySearch", "(", "getOffsets", "(", ")", ",", "offset", ")", ">=", "0", ";", "}", "public", "boolean", "isEndOfLineComment", "(", "int", "offset", ",", "char", "[", "]", "content", ")", "{", "if", "(", "offset", "<", "0", "||", "(", "offset", "<", "content", ".", "length", "&&", "!", "IndentManipulation", ".", "isLineDelimiterChar", "(", "content", "[", "offset", "]", ")", ")", ")", "{", "return", "false", ";", "}", "return", "Arrays", ".", "binarySearch", "(", "getOffsets", "(", ")", ",", "offset", ")", ">=", "0", ";", "}", "public", "boolean", "remove", "(", "int", "offset", ")", "{", "int", "[", "]", "offsetArray", "=", "getOffsets", "(", ")", ";", "int", "index", "=", "Arrays", ".", "binarySearch", "(", "offsetArray", ",", "offset", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "if", "(", "index", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "offsetArray", ",", "0", ",", "offsetArray", ",", "1", ",", "index", ")", ";", "}", "offsetArray", "[", "0", "]", "=", "-", "1", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
2,319
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "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", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Comment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ImportDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "LineComment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PackageDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "DefaultCodeFormatterConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeNameRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IRegion", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "Region", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "DeleteEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "InsertEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MultiTextEdit", ";", "public", "final", "class", "ImportRewriteAnalyzer", "{", "private", "final", "ICompilationUnit", "compilationUnit", ";", "private", "final", "ArrayList", "packageEntries", ";", "private", "final", "List", "importsCreated", ";", "private", "final", "List", "staticImportsCreated", ";", "private", "final", "IRegion", "replaceRange", ";", "private", "final", "int", "importOnDemandThreshold", ";", "private", "final", "int", "staticImportOnDemandThreshold", ";", "private", "boolean", "filterImplicitImports", ";", "private", "boolean", "useContextToFilterImplicitImports", ";", "private", "boolean", "findAmbiguousImports", ";", "private", "IRegion", "[", "]", "preserveExistingCommentsRanges", ";", "private", "int", "flags", "=", "0", ";", "private", "static", "final", "int", "F_NEEDS_LEADING_DELIM", "=", "2", ";", "private", "static", "final", "int", "F_NEEDS_TRAILING_DELIM", "=", "4", ";", "private", "static", "final", "String", "JAVA_LANG", "=", "\"java.lang\"", ";", "public", "ImportRewriteAnalyzer", "(", "ICompilationUnit", "cu", ",", "CompilationUnit", "root", ",", "String", "[", "]", "importOrder", ",", "int", "threshold", ",", "int", "staticThreshold", ",", "boolean", "restoreExistingImports", ",", "boolean", "useContextToFilterImplicitImports", ")", "{", "this", ".", "compilationUnit", "=", "cu", ";", "this", ".", "importOnDemandThreshold", "=", "threshold", ";", "this", ".", "staticImportOnDemandThreshold", "=", "staticThreshold", ";", "this", ".", "useContextToFilterImplicitImports", "=", "useContextToFilterImplicitImports", ";", "this", ".", "filterImplicitImports", "=", "true", ";", "this", ".", "findAmbiguousImports", "=", "true", ";", "this", ".", "packageEntries", "=", "new", "ArrayList", "(", "20", ")", ";", "this", ".", "importsCreated", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "staticImportsCreated", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "flags", "=", "0", ";", "this", ".", "replaceRange", "=", "evaluateReplaceRange", "(", "root", ")", ";", "if", "(", "restoreExistingImports", ")", "{", "addExistingImports", "(", "root", ")", ";", "}", "else", "{", "this", ".", "preserveExistingCommentsRanges", "=", "retrieveExistingCommentsInImports", "(", "root", ")", ";", "}", "PackageEntry", "[", "]", "order", "=", "new", "PackageEntry", "[", "importOrder", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "order", ".", "length", ";", "i", "++", ")", "{", "String", "curr", "=", "importOrder", "[", "i", "]", ";", "if", "(", "curr", ".", "length", "(", ")", ">", "0", "&&", "curr", ".", "charAt", "(", "0", ")", "==", "'#'", ")", "{", "curr", "=", "curr", ".", "substring", "(", "1", ")", ";", "order", "[", "i", "]", "=", "new", "PackageEntry", "(", "curr", ",", "curr", ",", "true", ")", ";", "}", "else", "{", "order", "[", "i", "]", "=", "new", "PackageEntry", "(", "curr", ",", "curr", ",", "false", ")", ";", "}", "}", "addPreferenceOrderHolders", "(", "order", ")", ";", "}", "private", "int", "getSpacesBetweenImportGroups", "(", ")", "{", "try", "{", "int", "num", "=", "Integer", ".", "parseInt", "(", "this", ".", "compilationUnit", ".", "getJavaProject", "(", ")", ".", "getOption", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS", ",", "true", ")", ")", ";", "if", "(", "num", ">=", "0", ")", "return", "num", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "return", "1", ";", "}", "private", "boolean", "insertSpaceBeforeSemicolon", "(", ")", "{", "return", "JavaCore", ".", "INSERT", ".", "equals", "(", "this", ".", "compilationUnit", ".", "getJavaProject", "(", ")", ".", "getOption", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON", ",", "true", ")", ")", ";", "}", "private", "void", "addPreferenceOrderHolders", "(", "PackageEntry", "[", "]", "preferenceOrder", ")", "{", "if", "(", "this", ".", "packageEntries", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "preferenceOrder", ".", "length", ";", "i", "++", ")", "{", "this", ".", "packageEntries", ".", "add", "(", "preferenceOrder", "[", "i", "]", ")", ";", "}", "}", "else", "{", "PackageEntry", "[", "]", "lastAssigned", "=", "new", "PackageEntry", "[", "preferenceOrder", ".", "length", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "k", "++", ")", "{", "PackageEntry", "entry", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "k", ")", ";", "if", "(", "!", "entry", ".", "isComment", "(", ")", ")", "{", "String", "currName", "=", "entry", ".", "getName", "(", ")", ";", "int", "currNameLen", "=", "currName", ".", "length", "(", ")", ";", "int", "bestGroupIndex", "=", "-", "1", ";", "int", "bestGroupLen", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "preferenceOrder", ".", "length", ";", "i", "++", ")", "{", "boolean", "currPrevStatic", "=", "preferenceOrder", "[", "i", "]", ".", "isStatic", "(", ")", ";", "if", "(", "currPrevStatic", "==", "entry", ".", "isStatic", "(", ")", ")", "{", "String", "currPrefEntry", "=", "preferenceOrder", "[", "i", "]", ".", "getName", "(", ")", ";", "int", "currPrefLen", "=", "currPrefEntry", ".", "length", "(", ")", ";", "if", "(", "currName", ".", "startsWith", "(", "currPrefEntry", ")", "&&", "currPrefLen", ">=", "bestGroupLen", ")", "{", "if", "(", "currPrefLen", "==", "currNameLen", "||", "currName", ".", "charAt", "(", "currPrefLen", ")", "==", "'.'", ")", "{", "if", "(", "bestGroupIndex", "==", "-", "1", "||", "currPrefLen", ">", "bestGroupLen", ")", "{", "bestGroupLen", "=", "currPrefLen", ";", "bestGroupIndex", "=", "i", ";", "}", "}", "}", "}", "}", "if", "(", "bestGroupIndex", "!=", "-", "1", ")", "{", "entry", ".", "setGroupID", "(", "preferenceOrder", "[", "bestGroupIndex", "]", ".", "getName", "(", ")", ")", ";", "lastAssigned", "[", "bestGroupIndex", "]", "=", "entry", ";", "}", "}", "}", "int", "currAppendIndex", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lastAssigned", ".", "length", ";", "i", "++", ")", "{", "PackageEntry", "entry", "=", "lastAssigned", "[", "i", "]", ";", "if", "(", "entry", "==", "null", ")", "{", "PackageEntry", "newEntry", "=", "preferenceOrder", "[", "i", "]", ";", "if", "(", "currAppendIndex", "==", "0", "&&", "!", "newEntry", ".", "isStatic", "(", ")", ")", "{", "currAppendIndex", "=", "getIndexAfterStatics", "(", ")", ";", "}", "this", ".", "packageEntries", ".", "add", "(", "currAppendIndex", ",", "newEntry", ")", ";", "currAppendIndex", "++", ";", "}", "else", "{", "currAppendIndex", "=", "this", ".", "packageEntries", ".", "indexOf", "(", "entry", ")", "+", "1", ";", "}", "}", "}", "}", "private", "String", "getQualifier", "(", "ImportDeclaration", "decl", ")", "{", "String", "name", "=", "decl", ".", "getName", "(", ")", ".", "getFullyQualifiedName", "(", ")", ";", "if", "(", "decl", ".", "isOnDemand", "(", ")", ")", "{", "return", "name", ";", "}", "return", "getQualifier", "(", "name", ",", "decl", ".", "isStatic", "(", ")", ")", ";", "}", "private", "String", "getQualifier", "(", "String", "name", ",", "boolean", "isStatic", ")", "{", "if", "(", "isStatic", "||", "!", "this", ".", "useContextToFilterImplicitImports", ")", "{", "return", "Signature", ".", "getQualifier", "(", "name", ")", ";", "}", "char", "[", "]", "searchedName", "=", "name", ".", "toCharArray", "(", ")", ";", "int", "index", "=", "name", ".", "length", "(", ")", ";", "JavaProject", "project", "=", "(", "JavaProject", ")", "this", ".", "compilationUnit", ".", "getJavaProject", "(", ")", ";", "do", "{", "String", "testedName", "=", "new", "String", "(", "searchedName", ",", "0", ",", "index", ")", ";", "IJavaElement", "fragment", "=", "null", ";", "try", "{", "fragment", "=", "project", ".", "findPackageFragment", "(", "testedName", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "name", ";", "}", "if", "(", "fragment", "!=", "null", ")", "{", "return", "testedName", ";", "}", "try", "{", "fragment", "=", "project", ".", "findType", "(", "testedName", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "name", ";", "}", "if", "(", "fragment", "!=", "null", ")", "{", "index", "=", "CharOperation", ".", "lastIndexOf", "(", "Signature", ".", "C_DOT", ",", "searchedName", ",", "0", ",", "index", "-", "1", ")", ";", "}", "else", "{", "index", "=", "CharOperation", ".", "lastIndexOf", "(", "Signature", ".", "C_DOT", ",", "searchedName", ",", "0", ",", "index", "-", "1", ")", ";", "if", "(", "Character", ".", "isLowerCase", "(", "searchedName", "[", "index", "+", "1", "]", ")", ")", "{", "return", "testedName", ";", "}", "}", "}", "while", "(", "index", ">=", "0", ")", ";", "return", "name", ";", "}", "private", "static", "String", "getFullName", "(", "ImportDeclaration", "decl", ")", "{", "String", "name", "=", "decl", ".", "getName", "(", ")", ".", "getFullyQualifiedName", "(", ")", ";", "return", "decl", ".", "isOnDemand", "(", ")", "?", "name", "+", "\".*\"", ":", "name", ";", "}", "private", "void", "addExistingImports", "(", "CompilationUnit", "root", ")", "{", "List", "decls", "=", "root", ".", "imports", "(", ")", ";", "if", "(", "decls", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "PackageEntry", "currPackage", "=", "null", ";", "ImportDeclaration", "curr", "=", "(", "ImportDeclaration", ")", "decls", ".", "get", "(", "0", ")", ";", "int", "currOffset", "=", "curr", ".", "getStartPosition", "(", ")", ";", "int", "currLength", "=", "curr", ".", "getLength", "(", ")", ";", "int", "currEndLine", "=", "root", ".", "getLineNumber", "(", "currOffset", "+", "currLength", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "decls", ".", "size", "(", ")", ";", "i", "++", ")", "{", "boolean", "isStatic", "=", "curr", ".", "isStatic", "(", ")", ";", "String", "name", "=", "getFullName", "(", "curr", ")", ";", "String", "packName", "=", "getQualifier", "(", "curr", ")", ";", "if", "(", "currPackage", "==", "null", "||", "currPackage", ".", "compareTo", "(", "packName", ",", "isStatic", ")", "!=", "0", ")", "{", "currPackage", "=", "new", "PackageEntry", "(", "packName", ",", "null", ",", "isStatic", ")", ";", "this", ".", "packageEntries", ".", "add", "(", "currPackage", ")", ";", "}", "ImportDeclaration", "next", "=", "(", "ImportDeclaration", ")", "decls", ".", "get", "(", "i", ")", ";", "int", "nextOffset", "=", "next", ".", "getStartPosition", "(", ")", ";", "int", "nextLength", "=", "next", ".", "getLength", "(", ")", ";", "int", "nextOffsetLine", "=", "root", ".", "getLineNumber", "(", "nextOffset", ")", ";", "int", "extendedStart", "=", "root", ".", "getExtendedStartPosition", "(", "curr", ")", ";", "if", "(", "extendedStart", "<", "this", ".", "replaceRange", ".", "getOffset", "(", ")", ")", "{", "extendedStart", "=", "currOffset", ";", "}", "int", "extendedLength", "=", "root", ".", "getExtendedLength", "(", "curr", ")", ";", "int", "nextLineOffset", "=", "nextOffset", ";", "if", "(", "currEndLine", "<", "nextOffsetLine", ")", "{", "currEndLine", "++", ";", "nextLineOffset", "=", "root", ".", "getPosition", "(", "currEndLine", ",", "0", ")", ";", "}", "IRegion", "rangeBefore", "=", "null", ";", "IRegion", "rangeAfter", "=", "null", ";", "if", "(", "currOffset", ">", "extendedStart", ")", "{", "rangeBefore", "=", "new", "Region", "(", "extendedStart", ",", "currOffset", "-", "extendedStart", ")", ";", "}", "int", "currLen", "=", "curr", ".", "getLength", "(", ")", ";", "if", "(", "currLen", "<", "extendedLength", "-", "(", "currOffset", "-", "extendedStart", ")", ")", "{", "int", "currEndOffset", "=", "currOffset", "+", "currLen", ";", "int", "rangeBeforeLen", "=", "rangeBefore", "!=", "null", "?", "rangeBefore", ".", "getLength", "(", ")", ":", "0", ";", "rangeAfter", "=", "new", "Region", "(", "currEndOffset", ",", "extendedLength", "-", "rangeBeforeLen", "-", "currLen", ")", ";", "}", "currPackage", ".", "add", "(", "new", "ImportDeclEntry", "(", "packName", ".", "length", "(", ")", ",", "name", ",", "isStatic", ",", "new", "Region", "(", "currOffset", ",", "nextLineOffset", "-", "currOffset", ")", ",", "rangeBefore", ",", "rangeAfter", ")", ")", ";", "currOffset", "=", "nextOffset", ";", "curr", "=", "next", ";", "if", "(", "currEndLine", "<", "nextOffsetLine", ")", "{", "nextOffset", "=", "root", ".", "getPosition", "(", "nextOffsetLine", ",", "0", ")", ";", "currPackage", "=", "new", "PackageEntry", "(", ")", ";", "this", ".", "packageEntries", ".", "add", "(", "currPackage", ")", ";", "currPackage", ".", "add", "(", "new", "ImportDeclEntry", "(", "packName", ".", "length", "(", ")", ",", "null", ",", "false", ",", "new", "Region", "(", "nextLineOffset", ",", "nextOffset", "-", "nextLineOffset", ")", ")", ")", ";", "currOffset", "=", "nextOffset", ";", "}", "currEndLine", "=", "root", ".", "getLineNumber", "(", "nextOffset", "+", "nextLength", ")", ";", "}", "boolean", "isStatic", "=", "curr", ".", "isStatic", "(", ")", ";", "String", "name", "=", "getFullName", "(", "curr", ")", ";", "String", "packName", "=", "getQualifier", "(", "curr", ")", ";", "if", "(", "currPackage", "==", "null", "||", "currPackage", ".", "compareTo", "(", "packName", ",", "isStatic", ")", "!=", "0", ")", "{", "currPackage", "=", "new", "PackageEntry", "(", "packName", ",", "null", ",", "isStatic", ")", ";", "this", ".", "packageEntries", ".", "add", "(", "currPackage", ")", ";", "}", "int", "currStartOffset", "=", "curr", ".", "getStartPosition", "(", ")", ";", "int", "currLen", "=", "curr", ".", "getLength", "(", ")", ";", "int", "extendedStartOffset", "=", "root", ".", "getExtendedStartPosition", "(", "curr", ")", ";", "IRegion", "leadingComments", "=", "null", ";", "IRegion", "allTrailingComments", "=", "null", ";", "if", "(", "currStartOffset", ">", "extendedStartOffset", ")", "{", "leadingComments", "=", "new", "Region", "(", "extendedStartOffset", ",", "currOffset", "-", "extendedStartOffset", ")", ";", "}", "int", "length", "=", "this", ".", "replaceRange", ".", "getOffset", "(", ")", "+", "this", ".", "replaceRange", ".", "getLength", "(", ")", "-", "currStartOffset", ";", "int", "extendedLength", "=", "root", ".", "getExtendedLength", "(", "curr", ")", ";", "if", "(", "currLen", "<", "extendedLength", "-", "(", "currOffset", "-", "extendedStartOffset", ")", ")", "{", "int", "currEndOffset", "=", "currOffset", "+", "currLen", ";", "int", "leadingCommentsLen", "=", "leadingComments", "!=", "null", "?", "leadingComments", ".", "getLength", "(", ")", ":", "0", ";", "allTrailingComments", "=", "new", "Region", "(", "currEndOffset", ",", "extendedLength", "-", "leadingCommentsLen", "-", "currLen", ")", ";", "}", "currPackage", ".", "add", "(", "new", "ImportDeclEntry", "(", "packName", ".", "length", "(", ")", ",", "name", ",", "isStatic", ",", "new", "Region", "(", "curr", ".", "getStartPosition", "(", ")", ",", "length", ")", ",", "leadingComments", ",", "allTrailingComments", ")", ")", ";", "}", "private", "IRegion", "[", "]", "retrieveExistingCommentsInImports", "(", "CompilationUnit", "root", ")", "{", "List", "decls", "=", "root", ".", "imports", "(", ")", ";", "if", "(", "decls", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "List", "commentList", "=", "root", ".", "getCommentList", "(", ")", ";", "int", "numberOfComments", "=", "commentList", ".", "size", "(", ")", ";", "List", "regions", "=", "null", ";", "int", "currentExtendedEnd", "=", "-", "1", ";", "int", "currEndLine", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "decls", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ImportDeclaration", "next", "=", "(", "ImportDeclaration", ")", "decls", ".", "get", "(", "i", ")", ";", "int", "nextOffset", "=", "next", ".", "getStartPosition", "(", ")", ";", "int", "nextLength", "=", "next", ".", "getLength", "(", ")", ";", "int", "extendedStart", "=", "root", ".", "getExtendedStartPosition", "(", "next", ")", ";", "int", "extendedLength", "=", "root", ".", "getExtendedLength", "(", "next", ")", ";", "int", "nextOffsetLine", "=", "root", ".", "getLineNumber", "(", "nextOffset", ")", ";", "if", "(", "nextOffset", "!=", "extendedStart", ")", "{", "int", "lengthOfPrecedingComment", "=", "nextOffset", "-", "extendedStart", ";", "if", "(", "i", "!=", "0", ")", "{", "if", "(", "regions", "==", "null", ")", "{", "regions", "=", "new", "ArrayList", "(", ")", ";", "}", "regions", ".", "add", "(", "new", "Region", "(", "extendedStart", ",", "lengthOfPrecedingComment", ")", ")", ";", "}", "if", "(", "extendedLength", "!=", "(", "nextLength", "+", "lengthOfPrecedingComment", ")", ")", "{", "int", "regionLength", "=", "extendedLength", "-", "(", "nextLength", "+", "lengthOfPrecedingComment", ")", ";", "if", "(", "regions", "==", "null", ")", "{", "regions", "=", "new", "ArrayList", "(", ")", ";", "}", "regions", ".", "add", "(", "new", "Region", "(", "nextOffset", "+", "nextLength", ",", "regionLength", ")", ")", ";", "}", "}", "else", "if", "(", "nextLength", "!=", "extendedLength", ")", "{", "int", "regionLength", "=", "extendedLength", "-", "nextLength", ";", "if", "(", "regions", "==", "null", ")", "{", "regions", "=", "new", "ArrayList", "(", ")", ";", "}", "regions", ".", "add", "(", "new", "Region", "(", "nextOffset", "+", "nextLength", ",", "regionLength", ")", ")", ";", "}", "if", "(", "i", ">", "0", ")", "{", "if", "(", "(", "nextOffsetLine", "-", "currEndLine", ")", ">", "1", ")", "{", "LineComment", "comment", "=", "root", ".", "getAST", "(", ")", ".", "newLineComment", "(", ")", ";", "comment", ".", "setSourceRange", "(", "currentExtendedEnd", "+", "1", ",", "0", ")", ";", "int", "index", "=", "Collections", ".", "binarySearch", "(", "commentList", ",", "comment", ",", "new", "Comparator", "(", ")", "{", "public", "int", "compare", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "return", "(", "(", "Comment", ")", "o1", ")", ".", "getStartPosition", "(", ")", "-", "(", "(", "Comment", ")", "o2", ")", ".", "getStartPosition", "(", ")", ";", "}", "}", ")", ";", "if", "(", "index", "<", "0", ")", "{", "loop", ":", "for", "(", "int", "j", "=", "-", "(", "index", "+", "1", ")", ";", "j", "<", "numberOfComments", ";", "j", "++", ")", "{", "Comment", "currentComment", "=", "(", "Comment", ")", "commentList", ".", "get", "(", "j", ")", ";", "int", "commentStartPosition", "=", "currentComment", ".", "getStartPosition", "(", ")", ";", "int", "commentLength", "=", "currentComment", ".", "getLength", "(", ")", ";", "if", "(", "(", "commentStartPosition", ">", "currentExtendedEnd", ")", "&&", "(", "(", "commentStartPosition", "+", "commentLength", "-", "1", ")", "<", "extendedStart", ")", ")", "{", "if", "(", "regions", "==", "null", ")", "{", "regions", "=", "new", "ArrayList", "(", ")", ";", "}", "regions", ".", "add", "(", "new", "Region", "(", "commentStartPosition", ",", "commentLength", ")", ")", ";", "}", "else", "{", "break", "loop", ";", "}", "}", "}", "}", "}", "currentExtendedEnd", "=", "extendedStart", "+", "extendedLength", "-", "1", ";", "currEndLine", "=", "root", ".", "getLineNumber", "(", "currentExtendedEnd", ")", ";", "}", "if", "(", "regions", "==", "null", ")", "{", "return", "null", ";", "}", "IRegion", "[", "]", "result", "=", "(", "IRegion", "[", "]", ")", "regions", ".", "toArray", "(", "new", "IRegion", "[", "regions", ".", "size", "(", ")", "]", ")", ";", "Arrays", ".", "sort", "(", "result", ",", "new", "Comparator", "(", ")", "{", "public", "int", "compare", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "return", "(", "(", "IRegion", ")", "o1", ")", ".", "getOffset", "(", ")", "-", "(", "(", "IRegion", ")", "o2", ")", ".", "getOffset", "(", ")", ";", "}", "}", ")", ";", "return", "result", ";", "}", "public", "void", "setFilterImplicitImports", "(", "boolean", "filterImplicitImports", ")", "{", "this", ".", "filterImplicitImports", "=", "filterImplicitImports", ";", "}", "public", "void", "setFindAmbiguousImports", "(", "boolean", "findAmbiguousImports", ")", "{", "this", ".", "findAmbiguousImports", "=", "findAmbiguousImports", ";", "}", "private", "static", "class", "PackageMatcher", "{", "private", "String", "newName", ";", "private", "String", "bestName", ";", "private", "int", "bestMatchLen", ";", "public", "PackageMatcher", "(", ")", "{", "}", "public", "void", "initialize", "(", "String", "newImportName", ",", "String", "bestImportName", ")", "{", "this", ".", "newName", "=", "newImportName", ";", "this", ".", "bestName", "=", "bestImportName", ";", "this", ".", "bestMatchLen", "=", "getCommonPrefixLength", "(", "bestImportName", ",", "newImportName", ")", ";", "}", "public", "boolean", "isBetterMatch", "(", "String", "currName", ",", "boolean", "preferCurr", ")", "{", "boolean", "isBetter", ";", "int", "currMatchLen", "=", "getCommonPrefixLength", "(", "currName", ",", "this", ".", "newName", ")", ";", "int", "matchDiff", "=", "currMatchLen", "-", "this", ".", "bestMatchLen", ";", "if", "(", "matchDiff", "==", "0", ")", "{", "if", "(", "currMatchLen", "==", "this", ".", "newName", ".", "length", "(", ")", "&&", "currMatchLen", "==", "currName", ".", "length", "(", ")", "&&", "currMatchLen", "==", "this", ".", "bestName", ".", "length", "(", ")", ")", "{", "isBetter", "=", "preferCurr", ";", "}", "else", "{", "isBetter", "=", "sameMatchLenTest", "(", "currName", ")", ";", "}", "}", "else", "{", "isBetter", "=", "(", "matchDiff", ">", "0", ")", ";", "}", "if", "(", "isBetter", ")", "{", "this", ".", "bestName", "=", "currName", ";", "this", ".", "bestMatchLen", "=", "currMatchLen", ";", "}", "return", "isBetter", ";", "}", "private", "boolean", "sameMatchLenTest", "(", "String", "currName", ")", "{", "int", "matchLen", "=", "this", ".", "bestMatchLen", ";", "char", "newChar", "=", "getCharAt", "(", "this", ".", "newName", ",", "matchLen", ")", ";", "char", "currChar", "=", "getCharAt", "(", "currName", ",", "matchLen", ")", ";", "char", "bestChar", "=", "getCharAt", "(", "this", ".", "bestName", ",", "matchLen", ")", ";", "if", "(", "newChar", "<", "currChar", ")", "{", "if", "(", "bestChar", "<", "newChar", ")", "{", "return", "(", "currChar", "-", "newChar", ")", "<", "(", "newChar", "-", "bestChar", ")", ";", "}", "else", "{", "if", "(", "currChar", "==", "bestChar", ")", "{", "return", "false", ";", "}", "else", "{", "return", "currChar", "<", "bestChar", ";", "}", "}", "}", "else", "{", "if", "(", "bestChar", ">", "newChar", ")", "{", "return", "(", "newChar", "-", "currChar", ")", "<", "(", "bestChar", "-", "newChar", ")", ";", "}", "else", "{", "if", "(", "currChar", "==", "bestChar", ")", "{", "return", "true", ";", "}", "else", "{", "return", "currChar", ">", "bestChar", ";", "}", "}", "}", "}", "}", "static", "int", "getCommonPrefixLength", "(", "String", "s", ",", "String", "t", ")", "{", "int", "len", "=", "Math", ".", "min", "(", "s", ".", "length", "(", ")", ",", "t", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "s", ".", "charAt", "(", "i", ")", "!=", "t", ".", "charAt", "(", "i", ")", ")", "{", "return", "i", ";", "}", "}", "return", "len", ";", "}", "static", "char", "getCharAt", "(", "String", "str", ",", "int", "index", ")", "{", "if", "(", "str", ".", "length", "(", ")", ">", "index", ")", "{", "return", "str", ".", "charAt", "(", "index", ")", ";", "}", "return", "0", ";", "}", "private", "PackageEntry", "findBestMatch", "(", "String", "newName", ",", "boolean", "isStatic", ")", "{", "if", "(", "this", ".", "packageEntries", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "String", "groupId", "=", "null", ";", "int", "longestPrefix", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "PackageEntry", "curr", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "isStatic", "==", "curr", ".", "isStatic", "(", ")", ")", "{", "String", "currGroup", "=", "curr", ".", "getGroupID", "(", ")", ";", "if", "(", "currGroup", "!=", "null", "&&", "newName", ".", "startsWith", "(", "currGroup", ")", ")", "{", "int", "prefixLen", "=", "currGroup", ".", "length", "(", ")", ";", "if", "(", "prefixLen", "==", "newName", ".", "length", "(", ")", ")", "{", "return", "curr", ";", "}", "if", "(", "(", "newName", ".", "charAt", "(", "prefixLen", ")", "==", "'.'", "||", "prefixLen", "==", "0", ")", "&&", "prefixLen", ">", "longestPrefix", ")", "{", "longestPrefix", "=", "prefixLen", ";", "groupId", "=", "currGroup", ";", "}", "}", "}", "}", "PackageEntry", "bestMatch", "=", "null", ";", "PackageMatcher", "matcher", "=", "new", "PackageMatcher", "(", ")", ";", "matcher", ".", "initialize", "(", "newName", ",", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "PackageEntry", "curr", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "!", "curr", ".", "isComment", "(", ")", "&&", "curr", ".", "isStatic", "(", ")", "==", "isStatic", ")", "{", "if", "(", "groupId", "==", "null", "||", "groupId", ".", "equals", "(", "curr", ".", "getGroupID", "(", ")", ")", ")", "{", "boolean", "preferrCurr", "=", "(", "bestMatch", "==", "null", ")", "||", "(", "curr", ".", "getNumberOfImports", "(", ")", ">", "bestMatch", ".", "getNumberOfImports", "(", ")", ")", ";", "if", "(", "matcher", ".", "isBetterMatch", "(", "curr", ".", "getName", "(", ")", ",", "preferrCurr", ")", ")", "{", "bestMatch", "=", "curr", ";", "}", "}", "}", "}", "return", "bestMatch", ";", "}", "private", "boolean", "isImplicitImport", "(", "String", "qualifier", ")", "{", "if", "(", "JAVA_LANG", ".", "equals", "(", "qualifier", ")", ")", "{", "return", "true", ";", "}", "ICompilationUnit", "cu", "=", "this", ".", "compilationUnit", ";", "String", "packageName", "=", "cu", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ";", "if", "(", "qualifier", ".", "equals", "(", "packageName", ")", ")", "{", "return", "true", ";", "}", "String", "mainTypeName", "=", "JavaCore", ".", "removeJavaLikeExtension", "(", "cu", ".", "getElementName", "(", ")", ")", ";", "if", "(", "packageName", ".", "length", "(", ")", "==", "0", ")", "{", "return", "qualifier", ".", "equals", "(", "mainTypeName", ")", ";", "}", "return", "qualifier", ".", "equals", "(", "packageName", "+", "'.'", "+", "mainTypeName", ")", ";", "}", "public", "void", "addImport", "(", "String", "fullTypeName", ",", "boolean", "isStatic", ")", "{", "String", "typeContainerName", "=", "getQualifier", "(", "fullTypeName", ",", "isStatic", ")", ";", "ImportDeclEntry", "decl", "=", "new", "ImportDeclEntry", "(", "typeContainerName", ".", "length", "(", ")", ",", "fullTypeName", ",", "isStatic", ",", "null", ")", ";", "sortIn", "(", "typeContainerName", ",", "decl", ",", "isStatic", ")", ";", "}", "public", "boolean", "removeImport", "(", "String", "qualifiedName", ",", "boolean", "isStatic", ")", "{", "String", "containerName", "=", "getQualifier", "(", "qualifiedName", ",", "isStatic", ")", ";", "int", "nPackages", "=", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nPackages", ";", "i", "++", ")", "{", "PackageEntry", "entry", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "entry", ".", "compareTo", "(", "containerName", ",", "isStatic", ")", "==", "0", ")", "{", "if", "(", "entry", ".", "remove", "(", "qualifiedName", ",", "isStatic", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "private", "int", "getIndexAfterStatics", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "(", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ")", ".", "isStatic", "(", ")", ")", "{", "return", "i", ";", "}", "}", "return", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "}", "private", "void", "sortIn", "(", "String", "typeContainerName", ",", "ImportDeclEntry", "decl", ",", "boolean", "isStatic", ")", "{", "PackageEntry", "bestMatch", "=", "findBestMatch", "(", "typeContainerName", ",", "isStatic", ")", ";", "if", "(", "bestMatch", "==", "null", ")", "{", "PackageEntry", "packEntry", "=", "new", "PackageEntry", "(", "typeContainerName", ",", "null", ",", "isStatic", ")", ";", "packEntry", ".", "add", "(", "decl", ")", ";", "int", "insertPos", "=", "packEntry", ".", "isStatic", "(", ")", "?", "0", ":", "getIndexAfterStatics", "(", ")", ";", "this", ".", "packageEntries", ".", "add", "(", "insertPos", ",", "packEntry", ")", ";", "}", "else", "{", "int", "cmp", "=", "typeContainerName", ".", "compareTo", "(", "bestMatch", ".", "getName", "(", ")", ")", ";", "if", "(", "cmp", "==", "0", ")", "{", "bestMatch", ".", "sortIn", "(", "decl", ")", ";", "}", "else", "{", "String", "group", "=", "bestMatch", ".", "getGroupID", "(", ")", ";", "if", "(", "group", "!=", "null", ")", "{", "if", "(", "!", "typeContainerName", ".", "startsWith", "(", "group", ")", ")", "{", "group", "=", "null", ";", "}", "}", "PackageEntry", "packEntry", "=", "new", "PackageEntry", "(", "typeContainerName", ",", "group", ",", "isStatic", ")", ";", "packEntry", ".", "add", "(", "decl", ")", ";", "int", "index", "=", "this", ".", "packageEntries", ".", "indexOf", "(", "bestMatch", ")", ";", "if", "(", "cmp", "<", "0", ")", "{", "this", ".", "packageEntries", ".", "add", "(", "index", ",", "packEntry", ")", ";", "}", "else", "{", "this", ".", "packageEntries", ".", "add", "(", "index", "+", "1", ",", "packEntry", ")", ";", "}", "}", "}", "}", "private", "IRegion", "evaluateReplaceRange", "(", "CompilationUnit", "root", ")", "{", "List", "imports", "=", "root", ".", "imports", "(", ")", ";", "if", "(", "!", "imports", ".", "isEmpty", "(", ")", ")", "{", "ImportDeclaration", "first", "=", "(", "ImportDeclaration", ")", "imports", ".", "get", "(", "0", ")", ";", "ImportDeclaration", "last", "=", "(", "ImportDeclaration", ")", "imports", ".", "get", "(", "imports", ".", "size", "(", ")", "-", "1", ")", ";", "int", "startPos", "=", "first", ".", "getStartPosition", "(", ")", ";", "int", "endPos", "=", "root", ".", "getExtendedStartPosition", "(", "last", ")", "+", "root", ".", "getExtendedLength", "(", "last", ")", ";", "int", "endLine", "=", "root", ".", "getLineNumber", "(", "endPos", ")", ";", "if", "(", "endLine", ">", "0", ")", "{", "int", "nextLinePos", "=", "root", ".", "getPosition", "(", "endLine", "+", "1", ",", "0", ")", ";", "if", "(", "nextLinePos", ">=", "0", ")", "{", "int", "firstTypePos", "=", "getFirstTypeBeginPos", "(", "root", ")", ";", "if", "(", "firstTypePos", "!=", "-", "1", "&&", "firstTypePos", "<", "nextLinePos", ")", "{", "endPos", "=", "firstTypePos", ";", "}", "else", "{", "endPos", "=", "nextLinePos", ";", "}", "}", "}", "return", "new", "Region", "(", "startPos", ",", "endPos", "-", "startPos", ")", ";", "}", "else", "{", "int", "start", "=", "getPackageStatementEndPos", "(", "root", ")", ";", "return", "new", "Region", "(", "start", ",", "0", ")", ";", "}", "}", "public", "MultiTextEdit", "getResultingEdits", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "monitor", "==", "null", ")", "{", "monitor", "=", "new", "NullProgressMonitor", "(", ")", ";", "}", "try", "{", "int", "importsStart", "=", "this", ".", "replaceRange", ".", "getOffset", "(", ")", ";", "int", "importsLen", "=", "this", ".", "replaceRange", ".", "getLength", "(", ")", ";", "String", "lineDelim", "=", "this", ".", "compilationUnit", ".", "findRecommendedLineSeparator", "(", ")", ";", "IBuffer", "buffer", "=", "this", ".", "compilationUnit", ".", "getBuffer", "(", ")", ";", "int", "currPos", "=", "importsStart", ";", "MultiTextEdit", "resEdit", "=", "new", "MultiTextEdit", "(", ")", ";", "if", "(", "(", "this", ".", "flags", "&", "F_NEEDS_LEADING_DELIM", ")", "!=", "0", ")", "{", "resEdit", ".", "addChild", "(", "new", "InsertEdit", "(", "currPos", ",", "lineDelim", ")", ")", ";", "}", "PackageEntry", "lastPackage", "=", "null", ";", "Set", "onDemandConflicts", "=", "null", ";", "if", "(", "this", ".", "findAmbiguousImports", ")", "{", "onDemandConflicts", "=", "evaluateStarImportConflicts", "(", "monitor", ")", ";", "}", "int", "spacesBetweenGroups", "=", "getSpacesBetweenImportGroups", "(", ")", ";", "ArrayList", "stringsToInsert", "=", "new", "ArrayList", "(", ")", ";", "int", "nPackageEntries", "=", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nPackageEntries", ";", "i", "++", ")", "{", "PackageEntry", "pack", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "this", ".", "filterImplicitImports", "&&", "!", "pack", ".", "isStatic", "(", ")", "&&", "isImplicitImport", "(", "pack", ".", "getName", "(", ")", ")", ")", "{", "pack", ".", "filterImplicitImports", "(", "this", ".", "useContextToFilterImplicitImports", ")", ";", "}", "int", "nImports", "=", "pack", ".", "getNumberOfImports", "(", ")", ";", "if", "(", "nImports", "==", "0", ")", "{", "continue", ";", "}", "if", "(", "spacesBetweenGroups", ">", "0", ")", "{", "if", "(", "lastPackage", "!=", "null", "&&", "!", "pack", ".", "isComment", "(", ")", "&&", "!", "pack", ".", "isSameGroup", "(", "lastPackage", ")", ")", "{", "ImportDeclEntry", "last", "=", "lastPackage", ".", "getImportAt", "(", "lastPackage", ".", "getNumberOfImports", "(", ")", "-", "1", ")", ";", "ImportDeclEntry", "first", "=", "pack", ".", "getImportAt", "(", "0", ")", ";", "if", "(", "!", "lastPackage", ".", "isComment", "(", ")", "&&", "(", "last", ".", "isNew", "(", ")", "||", "first", ".", "isNew", "(", ")", ")", ")", "{", "for", "(", "int", "k", "=", "spacesBetweenGroups", ";", "k", ">", "0", ";", "k", "--", ")", "{", "stringsToInsert", ".", "add", "(", "lineDelim", ")", ";", "}", "}", "}", "}", "lastPackage", "=", "pack", ";", "boolean", "isStatic", "=", "pack", ".", "isStatic", "(", ")", ";", "int", "threshold", "=", "isStatic", "?", "this", ".", "staticImportOnDemandThreshold", ":", "this", ".", "importOnDemandThreshold", ";", "boolean", "doStarImport", "=", "pack", ".", "hasStarImport", "(", "threshold", ",", "onDemandConflicts", ")", ";", "if", "(", "doStarImport", "&&", "(", "pack", ".", "find", "(", "\"*\"", ")", "==", "null", ")", ")", "{", "String", "[", "]", "imports", "=", "getNewImportStrings", "(", "buffer", ",", "pack", ",", "isStatic", ",", "lineDelim", ")", ";", "for", "(", "int", "j", "=", "0", ",", "max", "=", "imports", ".", "length", ";", "j", "<", "max", ";", "j", "++", ")", "{", "stringsToInsert", ".", "add", "(", "imports", "[", "j", "]", ")", ";", "}", "}", "for", "(", "int", "k", "=", "0", ";", "k", "<", "nImports", ";", "k", "++", ")", "{", "ImportDeclEntry", "currDecl", "=", "pack", ".", "getImportAt", "(", "k", ")", ";", "IRegion", "region", "=", "currDecl", ".", "getSourceRange", "(", ")", ";", "if", "(", "region", "==", "null", ")", "{", "if", "(", "!", "doStarImport", "||", "currDecl", ".", "isOnDemand", "(", ")", "||", "(", "onDemandConflicts", "!=", "null", "&&", "onDemandConflicts", ".", "contains", "(", "currDecl", ".", "getSimpleName", "(", ")", ")", ")", ")", "{", "String", "str", "=", "getNewImportString", "(", "currDecl", ".", "getElementName", "(", ")", ",", "isStatic", ",", "lineDelim", ")", ";", "stringsToInsert", ".", "add", "(", "str", ")", ";", "}", "else", "if", "(", "doStarImport", "&&", "!", "currDecl", ".", "isOnDemand", "(", ")", ")", "{", "String", "simpleName", "=", "currDecl", ".", "getTypeQualifiedName", "(", ")", ";", "if", "(", "simpleName", ".", "indexOf", "(", "'.'", ")", "!=", "-", "1", ")", "{", "String", "str", "=", "getNewImportString", "(", "currDecl", ".", "getElementName", "(", ")", ",", "isStatic", ",", "lineDelim", ")", ";", "if", "(", "stringsToInsert", ".", "indexOf", "(", "str", ")", "==", "-", "1", ")", "{", "stringsToInsert", ".", "add", "(", "str", ")", ";", "}", "}", "}", "}", "else", "if", "(", "!", "doStarImport", "||", "currDecl", ".", "isOnDemand", "(", ")", "||", "onDemandConflicts", "==", "null", "||", "onDemandConflicts", ".", "contains", "(", "currDecl", ".", "getSimpleName", "(", ")", ")", ")", "{", "int", "offset", "=", "region", ".", "getOffset", "(", ")", ";", "IRegion", "rangeBefore", "=", "currDecl", ".", "getPrecedingCommentRange", "(", ")", ";", "if", "(", "rangeBefore", "!=", "null", "&&", "currPos", ">", "rangeBefore", ".", "getOffset", "(", ")", ")", "{", "currPos", "=", "rangeBefore", ".", "getOffset", "(", ")", ";", "}", "if", "(", "rangeBefore", "!=", "null", ")", "{", "stringsToInsert", ".", "add", "(", "buffer", ".", "getText", "(", "rangeBefore", ".", "getOffset", "(", ")", ",", "rangeBefore", ".", "getLength", "(", ")", ")", ")", ";", "}", "removeAndInsertNew", "(", "buffer", ",", "currPos", ",", "offset", ",", "stringsToInsert", ",", "resEdit", ")", ";", "stringsToInsert", ".", "clear", "(", ")", ";", "currPos", "=", "offset", "+", "region", ".", "getLength", "(", ")", ";", "}", "else", "if", "(", "doStarImport", "&&", "!", "currDecl", ".", "isOnDemand", "(", ")", ")", "{", "String", "simpleName", "=", "currDecl", ".", "getTypeQualifiedName", "(", ")", ";", "if", "(", "simpleName", ".", "indexOf", "(", "'.'", ")", "!=", "-", "1", ")", "{", "IRegion", "rangeBefore", "=", "currDecl", ".", "getPrecedingCommentRange", "(", ")", ";", "if", "(", "rangeBefore", "!=", "null", "&&", "currPos", ">", "rangeBefore", ".", "getOffset", "(", ")", ")", "{", "currPos", "=", "rangeBefore", ".", "getOffset", "(", ")", ";", "}", "if", "(", "rangeBefore", "!=", "null", ")", "{", "stringsToInsert", ".", "add", "(", "buffer", ".", "getText", "(", "rangeBefore", ".", "getOffset", "(", ")", ",", "rangeBefore", ".", "getLength", "(", ")", ")", ")", ";", "}", "IRegion", "rangeAfter", "=", "currDecl", ".", "getTrailingCommentRange", "(", ")", ";", "String", "trailingComment", "=", "null", ";", "if", "(", "rangeAfter", "!=", "null", ")", "{", "trailingComment", "=", "buffer", ".", "getText", "(", "rangeAfter", ".", "getOffset", "(", ")", ",", "rangeAfter", ".", "getLength", "(", ")", ")", ";", "}", "String", "str", "=", "getNewImportString", "(", "currDecl", ".", "getElementName", "(", ")", ",", "isStatic", ",", "trailingComment", ",", "lineDelim", ")", ";", "if", "(", "stringsToInsert", ".", "indexOf", "(", "str", ")", "==", "-", "1", ")", "{", "stringsToInsert", ".", "add", "(", "str", ")", ";", "}", "}", "}", "}", "}", "if", "(", "this", ".", "preserveExistingCommentsRanges", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "preserveExistingCommentsRanges", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IRegion", "region", "=", "this", ".", "preserveExistingCommentsRanges", "[", "i", "]", ";", "String", "text", "=", "buffer", ".", "getText", "(", "region", ".", "getOffset", "(", ")", ",", "region", ".", "getLength", "(", ")", ")", ";", "int", "index", "=", "0", ";", "int", "length", "=", "text", ".", "length", "(", ")", ";", "loop", ":", "while", "(", "index", "<", "length", ")", "{", "if", "(", "Character", ".", "isWhitespace", "(", "text", ".", "charAt", "(", "index", ")", ")", ")", "{", "index", "++", ";", "}", "else", "{", "break", "loop", ";", "}", "}", "if", "(", "index", "!=", "0", ")", "{", "text", "=", "text", ".", "substring", "(", "index", ")", ";", "}", "if", "(", "!", "text", ".", "endsWith", "(", "lineDelim", ")", ")", "{", "text", "+=", "lineDelim", ";", "}", "stringsToInsert", ".", "add", "(", "text", ")", ";", "}", "}", "int", "end", "=", "importsStart", "+", "importsLen", ";", "removeAndInsertNew", "(", "buffer", ",", "currPos", ",", "end", ",", "stringsToInsert", ",", "resEdit", ")", ";", "if", "(", "importsLen", "==", "0", ")", "{", "if", "(", "!", "this", ".", "importsCreated", ".", "isEmpty", "(", ")", "||", "!", "this", ".", "staticImportsCreated", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "(", "this", ".", "flags", "&", "F_NEEDS_TRAILING_DELIM", ")", "!=", "0", ")", "{", "resEdit", ".", "addChild", "(", "new", "InsertEdit", "(", "currPos", ",", "lineDelim", ")", ")", ";", "}", "}", "else", "{", "return", "new", "MultiTextEdit", "(", ")", ";", "}", "}", "return", "resEdit", ";", "}", "finally", "{", "monitor", ".", "done", "(", ")", ";", "}", "}", "private", "void", "removeAndInsertNew", "(", "IBuffer", "buffer", ",", "int", "contentOffset", ",", "int", "contentEnd", ",", "ArrayList", "stringsToInsert", ",", "MultiTextEdit", "resEdit", ")", "{", "int", "pos", "=", "contentOffset", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stringsToInsert", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curr", "=", "(", "String", ")", "stringsToInsert", ".", "get", "(", "i", ")", ";", "int", "idx", "=", "findInBuffer", "(", "buffer", ",", "curr", ",", "pos", ",", "contentEnd", ")", ";", "if", "(", "idx", "!=", "-", "1", ")", "{", "if", "(", "idx", "!=", "pos", ")", "{", "resEdit", ".", "addChild", "(", "new", "DeleteEdit", "(", "pos", ",", "idx", "-", "pos", ")", ")", ";", "}", "pos", "=", "idx", "+", "curr", ".", "length", "(", ")", ";", "}", "else", "{", "resEdit", ".", "addChild", "(", "new", "InsertEdit", "(", "pos", ",", "curr", ")", ")", ";", "}", "}", "if", "(", "pos", "<", "contentEnd", ")", "{", "resEdit", ".", "addChild", "(", "new", "DeleteEdit", "(", "pos", ",", "contentEnd", "-", "pos", ")", ")", ";", "}", "}", "private", "int", "findInBuffer", "(", "IBuffer", "buffer", ",", "String", "str", ",", "int", "start", ",", "int", "end", ")", "{", "int", "pos", "=", "start", ";", "int", "len", "=", "str", ".", "length", "(", ")", ";", "if", "(", "pos", "+", "len", ">", "end", "||", "str", ".", "length", "(", ")", "==", "0", ")", "{", "return", "-", "1", ";", "}", "char", "first", "=", "str", ".", "charAt", "(", "0", ")", ";", "int", "step", "=", "str", ".", "indexOf", "(", "first", ",", "1", ")", ";", "if", "(", "step", "==", "-", "1", ")", "{", "step", "=", "len", ";", "}", "while", "(", "pos", "+", "len", "<=", "end", ")", "{", "if", "(", "buffer", ".", "getChar", "(", "pos", ")", "==", "first", ")", "{", "int", "k", "=", "1", ";", "while", "(", "k", "<", "len", "&&", "buffer", ".", "getChar", "(", "pos", "+", "k", ")", "==", "str", ".", "charAt", "(", "k", ")", ")", "{", "k", "++", ";", "}", "if", "(", "k", "==", "len", ")", "{", "return", "pos", ";", "}", "if", "(", "k", "<", "step", ")", "{", "pos", "+=", "k", ";", "}", "else", "{", "pos", "+=", "step", ";", "}", "}", "else", "{", "pos", "++", ";", "}", "}", "return", "-", "1", ";", "}", "private", "Set", "evaluateStarImportConflicts", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "final", "HashSet", "onDemandConflicts", "=", "new", "HashSet", "(", ")", ";", "IJavaSearchScope", "scope", "=", "SearchEngine", ".", "createJavaSearchScope", "(", "new", "IJavaElement", "[", "]", "{", "this", ".", "compilationUnit", ".", "getJavaProject", "(", ")", "}", ")", ";", "ArrayList", "starImportPackages", "=", "new", "ArrayList", "(", ")", ";", "ArrayList", "simpleTypeNames", "=", "new", "ArrayList", "(", ")", ";", "int", "nPackageEntries", "=", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nPackageEntries", ";", "i", "++", ")", "{", "PackageEntry", "pack", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "!", "pack", ".", "isStatic", "(", ")", "&&", "pack", ".", "hasStarImport", "(", "this", ".", "importOnDemandThreshold", ",", "null", ")", ")", "{", "starImportPackages", ".", "add", "(", "pack", ".", "getName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "pack", ".", "getNumberOfImports", "(", ")", ";", "k", "++", ")", "{", "ImportDeclEntry", "curr", "=", "pack", ".", "getImportAt", "(", "k", ")", ";", "if", "(", "!", "curr", ".", "isOnDemand", "(", ")", "&&", "!", "curr", ".", "isComment", "(", ")", ")", "{", "simpleTypeNames", ".", "add", "(", "curr", ".", "getSimpleName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "}", "}", "}", "if", "(", "starImportPackages", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "starImportPackages", ".", "add", "(", "this", ".", "compilationUnit", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "starImportPackages", ".", "add", "(", "JAVA_LANG", ".", "toCharArray", "(", ")", ")", ";", "char", "[", "]", "[", "]", "allPackages", "=", "(", "char", "[", "]", "[", "]", ")", "starImportPackages", ".", "toArray", "(", "new", "char", "[", "starImportPackages", ".", "size", "(", ")", "]", "[", "]", ")", ";", "char", "[", "]", "[", "]", "allTypes", "=", "(", "char", "[", "]", "[", "]", ")", "simpleTypeNames", ".", "toArray", "(", "new", "char", "[", "simpleTypeNames", ".", "size", "(", ")", "]", "[", "]", ")", ";", "TypeNameRequestor", "requestor", "=", "new", "TypeNameRequestor", "(", ")", "{", "HashMap", "foundTypes", "=", "new", "HashMap", "(", ")", ";", "private", "String", "getTypeContainerName", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "packageName", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "enclosingTypeNames", ".", "length", ";", "i", "++", ")", "{", "if", "(", "buf", ".", "length", "(", ")", ">", "0", ")", "buf", ".", "append", "(", "'.'", ")", ";", "buf", ".", "append", "(", "enclosingTypeNames", "[", "i", "]", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ")", "{", "String", "name", "=", "new", "String", "(", "simpleTypeName", ")", ";", "String", "containerName", "=", "getTypeContainerName", "(", "packageName", ",", "enclosingTypeNames", ")", ";", "String", "oldContainer", "=", "(", "String", ")", "this", ".", "foundTypes", ".", "put", "(", "name", ",", "containerName", ")", ";", "if", "(", "oldContainer", "!=", "null", "&&", "!", "oldContainer", ".", "equals", "(", "containerName", ")", ")", "{", "onDemandConflicts", ".", "add", "(", "name", ")", ";", "}", "}", "}", ";", "new", "SearchEngine", "(", ")", ".", "searchAllTypeNames", "(", "allPackages", ",", "allTypes", ",", "scope", ",", "requestor", ",", "IJavaSearchConstants", ".", "WAIT_UNTIL_READY_TO_SEARCH", ",", "monitor", ")", ";", "return", "onDemandConflicts", ";", "}", "private", "String", "getNewImportString", "(", "String", "importName", ",", "boolean", "isStatic", ",", "String", "lineDelim", ")", "{", "return", "getNewImportString", "(", "importName", ",", "isStatic", ",", "null", ",", "lineDelim", ")", ";", "}", "private", "String", "getNewImportString", "(", "String", "importName", ",", "boolean", "isStatic", ",", "String", "trailingComment", ",", "String", "lineDelim", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "\"import", "\"", ")", ";", "if", "(", "isStatic", ")", "{", "buf", ".", "append", "(", "\"static", "\"", ")", ";", "}", "buf", ".", "append", "(", "importName", ")", ";", "if", "(", "insertSpaceBeforeSemicolon", "(", ")", ")", "buf", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "';'", ")", ";", "if", "(", "trailingComment", "!=", "null", ")", "{", "buf", ".", "append", "(", "trailingComment", ")", ";", "}", "buf", ".", "append", "(", "lineDelim", ")", ";", "if", "(", "isStatic", ")", "{", "this", ".", "staticImportsCreated", ".", "add", "(", "importName", ")", ";", "}", "else", "{", "this", ".", "importsCreated", ".", "add", "(", "importName", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "private", "String", "[", "]", "getNewImportStrings", "(", "IBuffer", "buffer", ",", "PackageEntry", "packageEntry", ",", "boolean", "isStatic", ",", "String", "lineDelim", ")", "{", "boolean", "isStarImportAdded", "=", "false", ";", "List", "allImports", "=", "new", "ArrayList", "(", ")", ";", "int", "nImports", "=", "packageEntry", ".", "getNumberOfImports", "(", ")", ";", "StringBuffer", "allComments", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nImports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "packageEntry", ".", "getImportAt", "(", "i", ")", ";", "String", "simpleName", "=", "curr", ".", "getTypeQualifiedName", "(", ")", ";", "if", "(", "simpleName", ".", "indexOf", "(", "'.'", ")", "!=", "-", "1", ")", "{", "IRegion", "rangeBefore", "=", "curr", ".", "getPrecedingCommentRange", "(", ")", ";", "if", "(", "rangeBefore", "!=", "null", ")", "{", "allImports", ".", "add", "(", "buffer", ".", "getText", "(", "rangeBefore", ".", "getOffset", "(", ")", ",", "rangeBefore", ".", "getLength", "(", ")", ")", ")", ";", "}", "IRegion", "rangeAfter", "=", "curr", ".", "getTrailingCommentRange", "(", ")", ";", "String", "trailingComment", "=", "null", ";", "if", "(", "rangeAfter", "!=", "null", ")", "{", "trailingComment", "=", "buffer", ".", "getText", "(", "rangeAfter", ".", "getOffset", "(", ")", ",", "rangeAfter", ".", "getLength", "(", ")", ")", ";", "}", "allImports", ".", "add", "(", "getNewImportString", "(", "curr", ".", "getElementName", "(", ")", ",", "isStatic", ",", "trailingComment", ",", "lineDelim", ")", ")", ";", "}", "else", "if", "(", "!", "isStarImportAdded", ")", "{", "String", "starImportString", "=", "packageEntry", ".", "getName", "(", ")", "+", "\".*\"", ";", "allImports", ".", "add", "(", "getNewImportString", "(", "starImportString", ",", "isStatic", ",", "lineDelim", ")", ")", ";", "isStarImportAdded", "=", "true", ";", "}", "else", "{", "IRegion", "rangeBefore", "=", "curr", ".", "getPrecedingCommentRange", "(", ")", ";", "if", "(", "rangeBefore", "!=", "null", ")", "{", "if", "(", "allComments", "==", "null", ")", "{", "allComments", "=", "new", "StringBuffer", "(", ")", ";", "}", "allComments", ".", "append", "(", "buffer", ".", "getText", "(", "rangeBefore", ".", "getOffset", "(", ")", ",", "rangeBefore", ".", "getLength", "(", ")", ")", ")", ".", "append", "(", "lineDelim", ")", ";", "}", "IRegion", "rangeAfter", "=", "curr", ".", "getTrailingCommentRange", "(", ")", ";", "if", "(", "rangeAfter", "!=", "null", ")", "{", "if", "(", "allComments", "==", "null", ")", "{", "allComments", "=", "new", "StringBuffer", "(", ")", ";", "}", "allComments", ".", "append", "(", "buffer", ".", "getText", "(", "rangeAfter", ".", "getOffset", "(", ")", ",", "rangeAfter", ".", "getLength", "(", ")", ")", ")", ".", "append", "(", "lineDelim", ")", ";", "}", "}", "}", "if", "(", "allComments", "!=", "null", ")", "{", "allImports", ".", "add", "(", "0", ",", "String", ".", "valueOf", "(", "allComments", ")", ")", ";", "}", "return", "(", "String", "[", "]", ")", "allImports", ".", "toArray", "(", "new", "String", "[", "allImports", ".", "size", "(", ")", "]", ")", ";", "}", "private", "static", "int", "getFirstTypeBeginPos", "(", "CompilationUnit", "root", ")", "{", "List", "types", "=", "root", ".", "types", "(", ")", ";", "if", "(", "!", "types", ".", "isEmpty", "(", ")", ")", "{", "return", "root", ".", "getExtendedStartPosition", "(", "(", "(", "ASTNode", ")", "types", ".", "get", "(", "0", ")", ")", ")", ";", "}", "return", "-", "1", ";", "}", "private", "int", "getPackageStatementEndPos", "(", "CompilationUnit", "root", ")", "{", "PackageDeclaration", "packDecl", "=", "root", ".", "getPackage", "(", ")", ";", "if", "(", "packDecl", "!=", "null", ")", "{", "int", "afterPackageStatementPos", "=", "-", "1", ";", "int", "lineNumber", "=", "root", ".", "getLineNumber", "(", "packDecl", ".", "getStartPosition", "(", ")", "+", "packDecl", ".", "getLength", "(", ")", ")", ";", "if", "(", "lineNumber", ">=", "0", ")", "{", "int", "lineAfterPackage", "=", "lineNumber", "+", "1", ";", "afterPackageStatementPos", "=", "root", ".", "getPosition", "(", "lineAfterPackage", ",", "0", ")", ";", "}", "if", "(", "afterPackageStatementPos", "<", "0", ")", "{", "this", ".", "flags", "|=", "F_NEEDS_LEADING_DELIM", ";", "return", "packDecl", ".", "getStartPosition", "(", ")", "+", "packDecl", ".", "getLength", "(", ")", ";", "}", "int", "firstTypePos", "=", "getFirstTypeBeginPos", "(", "root", ")", ";", "if", "(", "firstTypePos", "!=", "-", "1", "&&", "firstTypePos", "<=", "afterPackageStatementPos", ")", "{", "this", ".", "flags", "|=", "F_NEEDS_TRAILING_DELIM", ";", "if", "(", "firstTypePos", "==", "afterPackageStatementPos", ")", "{", "this", ".", "flags", "|=", "F_NEEDS_LEADING_DELIM", ";", "}", "return", "firstTypePos", ";", "}", "this", ".", "flags", "|=", "F_NEEDS_LEADING_DELIM", ";", "return", "afterPackageStatementPos", ";", "}", "this", ".", "flags", "|=", "F_NEEDS_TRAILING_DELIM", ";", "return", "0", ";", "}", "public", "String", "toString", "(", ")", "{", "int", "nPackages", "=", "this", ".", "packageEntries", ".", "size", "(", ")", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nPackages", ";", "i", "++", ")", "{", "PackageEntry", "entry", "=", "(", "PackageEntry", ")", "this", ".", "packageEntries", ".", "get", "(", "i", ")", ";", "if", "(", "entry", ".", "isStatic", "(", ")", ")", "{", "buf", ".", "append", "(", "\"static", "\"", ")", ";", "}", "buf", ".", "append", "(", "entry", ".", "toString", "(", ")", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "private", "static", "final", "class", "ImportDeclEntry", "{", "private", "String", "elementName", ";", "private", "IRegion", "sourceRange", ";", "private", "final", "boolean", "isStatic", ";", "private", "int", "containerNameLength", ";", "private", "IRegion", "precedingCommentRange", ";", "private", "IRegion", "trailingCommentRange", ";", "public", "ImportDeclEntry", "(", "int", "containerNameLength", ",", "String", "elementName", ",", "boolean", "isStatic", ",", "IRegion", "sourceRange", ",", "IRegion", "precedingCommentRange", ",", "IRegion", "trailingCommentRange", ")", "{", "this", "(", "containerNameLength", ",", "elementName", ",", "isStatic", ",", "sourceRange", ")", ";", "this", ".", "precedingCommentRange", "=", "precedingCommentRange", ";", "this", ".", "trailingCommentRange", "=", "trailingCommentRange", ";", "}", "public", "ImportDeclEntry", "(", "int", "containerNameLength", ",", "String", "elementName", ",", "boolean", "isStatic", ",", "IRegion", "sourceRange", ")", "{", "this", ".", "elementName", "=", "elementName", ";", "this", ".", "sourceRange", "=", "sourceRange", ";", "this", ".", "isStatic", "=", "isStatic", ";", "this", ".", "containerNameLength", "=", "containerNameLength", ";", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "elementName", ";", "}", "public", "int", "compareTo", "(", "String", "fullName", ",", "boolean", "isStaticImport", ")", "{", "int", "cmp", "=", "this", ".", "elementName", ".", "compareTo", "(", "fullName", ")", ";", "if", "(", "cmp", "==", "0", ")", "{", "if", "(", "this", ".", "isStatic", "==", "isStaticImport", ")", "{", "return", "0", ";", "}", "return", "this", ".", "isStatic", "?", "-", "1", ":", "1", ";", "}", "return", "cmp", ";", "}", "public", "String", "getSimpleName", "(", ")", "{", "return", "Signature", ".", "getSimpleName", "(", "this", ".", "elementName", ")", ";", "}", "public", "String", "getTypeQualifiedName", "(", ")", "{", "return", "this", ".", "elementName", ".", "substring", "(", "this", ".", "containerNameLength", "+", "1", ")", ";", "}", "public", "boolean", "isOnDemand", "(", ")", "{", "return", "this", ".", "elementName", "!=", "null", "&&", "this", ".", "elementName", ".", "endsWith", "(", "\".*\"", ")", ";", "}", "public", "boolean", "isStatic", "(", ")", "{", "return", "this", ".", "isStatic", ";", "}", "public", "boolean", "isNew", "(", ")", "{", "return", "this", ".", "sourceRange", "==", "null", ";", "}", "public", "boolean", "isComment", "(", ")", "{", "return", "this", ".", "elementName", "==", "null", ";", "}", "public", "IRegion", "getSourceRange", "(", ")", "{", "return", "this", ".", "sourceRange", ";", "}", "public", "IRegion", "getPrecedingCommentRange", "(", ")", "{", "return", "this", ".", "precedingCommentRange", ";", "}", "public", "IRegion", "getTrailingCommentRange", "(", ")", "{", "return", "this", ".", "trailingCommentRange", ";", "}", "}", "private", "final", "static", "class", "PackageEntry", "{", "private", "String", "name", ";", "private", "ArrayList", "importEntries", ";", "private", "String", "group", ";", "private", "boolean", "isStatic", ";", "public", "PackageEntry", "(", ")", "{", "this", "(", "\"!\"", ",", "null", ",", "false", ")", ";", "}", "public", "PackageEntry", "(", "String", "name", ",", "String", "group", ",", "boolean", "isStatic", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "importEntries", "=", "new", "ArrayList", "(", "5", ")", ";", "this", ".", "group", "=", "group", ";", "this", ".", "isStatic", "=", "isStatic", ";", "}", "public", "boolean", "isStatic", "(", ")", "{", "return", "this", ".", "isStatic", ";", "}", "public", "int", "compareTo", "(", "String", "otherName", ",", "boolean", "isOtherStatic", ")", "{", "int", "cmp", "=", "this", ".", "name", ".", "compareTo", "(", "otherName", ")", ";", "if", "(", "cmp", "==", "0", ")", "{", "if", "(", "this", ".", "isStatic", "==", "isOtherStatic", ")", "{", "return", "0", ";", "}", "return", "this", ".", "isStatic", "?", "-", "1", ":", "1", ";", "}", "return", "cmp", ";", "}", "public", "void", "sortIn", "(", "ImportDeclEntry", "imp", ")", "{", "String", "fullImportName", "=", "imp", ".", "getElementName", "(", ")", ";", "int", "insertPosition", "=", "-", "1", ";", "int", "nInports", "=", "this", ".", "importEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nInports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "if", "(", "!", "curr", ".", "isComment", "(", ")", ")", "{", "int", "cmp", "=", "curr", ".", "compareTo", "(", "fullImportName", ",", "imp", ".", "isStatic", "(", ")", ")", ";", "if", "(", "cmp", "==", "0", ")", "{", "return", ";", "}", "else", "if", "(", "cmp", ">", "0", "&&", "insertPosition", "==", "-", "1", ")", "{", "insertPosition", "=", "i", ";", "}", "}", "}", "if", "(", "insertPosition", "==", "-", "1", ")", "{", "this", ".", "importEntries", ".", "add", "(", "imp", ")", ";", "}", "else", "{", "this", ".", "importEntries", ".", "add", "(", "insertPosition", ",", "imp", ")", ";", "}", "}", "public", "void", "add", "(", "ImportDeclEntry", "imp", ")", "{", "this", ".", "importEntries", ".", "add", "(", "imp", ")", ";", "}", "public", "ImportDeclEntry", "find", "(", "String", "simpleName", ")", "{", "int", "nInports", "=", "this", ".", "importEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nInports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "if", "(", "!", "curr", ".", "isComment", "(", ")", ")", "{", "String", "currName", "=", "curr", ".", "getElementName", "(", ")", ";", "if", "(", "currName", ".", "endsWith", "(", "simpleName", ")", ")", "{", "int", "dotPos", "=", "currName", ".", "length", "(", ")", "-", "simpleName", ".", "length", "(", ")", "-", "1", ";", "if", "(", "(", "dotPos", "==", "-", "1", ")", "||", "(", "dotPos", ">", "0", "&&", "currName", ".", "charAt", "(", "dotPos", ")", "==", "'.'", ")", ")", "{", "return", "curr", ";", "}", "}", "}", "}", "return", "null", ";", "}", "public", "boolean", "remove", "(", "String", "fullName", ",", "boolean", "isStaticImport", ")", "{", "int", "nInports", "=", "this", ".", "importEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nInports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "if", "(", "!", "curr", ".", "isComment", "(", ")", "&&", "curr", ".", "compareTo", "(", "fullName", ",", "isStaticImport", ")", "==", "0", ")", "{", "this", ".", "importEntries", ".", "remove", "(", "i", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "void", "filterImplicitImports", "(", "boolean", "useContextToFilterImplicitImports", ")", "{", "int", "nInports", "=", "this", ".", "importEntries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "nInports", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "if", "(", "curr", ".", "isNew", "(", ")", ")", "{", "if", "(", "!", "useContextToFilterImplicitImports", ")", "{", "this", ".", "importEntries", ".", "remove", "(", "i", ")", ";", "}", "else", "{", "String", "elementName", "=", "curr", ".", "getElementName", "(", ")", ";", "int", "lastIndexOf", "=", "elementName", ".", "lastIndexOf", "(", "'.'", ")", ";", "boolean", "internalClassImport", "=", "lastIndexOf", ">", "getName", "(", ")", ".", "length", "(", ")", ";", "if", "(", "!", "internalClassImport", ")", "{", "this", ".", "importEntries", ".", "remove", "(", "i", ")", ";", "}", "}", "}", "}", "}", "public", "ImportDeclEntry", "getImportAt", "(", "int", "index", ")", "{", "return", "(", "ImportDeclEntry", ")", "this", ".", "importEntries", ".", "get", "(", "index", ")", ";", "}", "public", "boolean", "hasStarImport", "(", "int", "threshold", ",", "Set", "explicitImports", ")", "{", "if", "(", "isComment", "(", ")", "||", "isDefaultPackage", "(", ")", ")", "{", "return", "false", ";", "}", "int", "nImports", "=", "getNumberOfImports", "(", ")", ";", "int", "count", "=", "0", ";", "boolean", "containsNew", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nImports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "if", "(", "curr", ".", "isOnDemand", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "curr", ".", "isComment", "(", ")", ")", "{", "count", "++", ";", "boolean", "isExplicit", "=", "!", "curr", ".", "isStatic", "(", ")", "&&", "(", "explicitImports", "!=", "null", ")", "&&", "explicitImports", ".", "contains", "(", "curr", ".", "getSimpleName", "(", ")", ")", ";", "containsNew", "|=", "curr", ".", "isNew", "(", ")", "&&", "!", "isExplicit", ";", "}", "}", "return", "(", "count", ">=", "threshold", ")", "&&", "containsNew", ";", "}", "public", "int", "getNumberOfImports", "(", ")", "{", "return", "this", ".", "importEntries", ".", "size", "(", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "String", "getGroupID", "(", ")", "{", "return", "this", ".", "group", ";", "}", "public", "void", "setGroupID", "(", "String", "groupID", ")", "{", "this", ".", "group", "=", "groupID", ";", "}", "public", "boolean", "isSameGroup", "(", "PackageEntry", "other", ")", "{", "if", "(", "this", ".", "group", "==", "null", ")", "{", "return", "other", ".", "getGroupID", "(", ")", "==", "null", ";", "}", "else", "{", "return", "this", ".", "group", ".", "equals", "(", "other", ".", "getGroupID", "(", ")", ")", "&&", "(", "this", ".", "isStatic", "==", "other", ".", "isStatic", "(", ")", ")", ";", "}", "}", "public", "boolean", "isComment", "(", ")", "{", "return", "\"!\"", ".", "equals", "(", "this", ".", "name", ")", ";", "}", "public", "boolean", "isDefaultPackage", "(", ")", "{", "return", "this", ".", "name", ".", "length", "(", ")", "==", "0", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "isComment", "(", ")", ")", "{", "buf", ".", "append", "(", "\"commentn\"", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "this", ".", "name", ")", ";", "buf", ".", "append", "(", "\",", "groupId:", "\"", ")", ";", "buf", ".", "append", "(", "this", ".", "group", ")", ";", "buf", ".", "append", "(", "\"n\"", ")", ";", "int", "nImports", "=", "getNumberOfImports", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nImports", ";", "i", "++", ")", "{", "ImportDeclEntry", "curr", "=", "getImportAt", "(", "i", ")", ";", "buf", ".", "append", "(", "\"", "\"", ")", ";", "if", "(", "curr", ".", "isStatic", "(", ")", ")", "{", "buf", ".", "append", "(", "\"static", "\"", ")", ";", "}", "buf", ".", "append", "(", "curr", ".", "getTypeQualifiedName", "(", ")", ")", ";", "if", "(", "curr", ".", "isNew", "(", ")", ")", "{", "buf", ".", "append", "(", "\"", "(new)\"", ")", ";", "}", "buf", ".", "append", "(", "\"n\"", ")", ";", "}", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "public", "String", "[", "]", "getCreatedImports", "(", ")", "{", "return", "(", "String", "[", "]", ")", "this", ".", "importsCreated", ".", "toArray", "(", "new", "String", "[", "this", ".", "importsCreated", ".", "size", "(", ")", "]", ")", ";", "}", "public", "String", "[", "]", "getCreatedStaticImports", "(", ")", "{", "return", "(", "String", "[", "]", ")", "this", ".", "staticImportsCreated", ".", "toArray", "(", "new", "String", "[", "this", ".", "staticImportsCreated", ".", "size", "(", ")", "]", ")", ";", "}", "}", "</s>" ]
2,320
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ToolFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Block", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BodyDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Statement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "CodeFormatter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "DefaultCodeFormatterConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "IndentManipulation", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadLocationException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadPositionCategoryException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "DefaultPositionUpdater", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "Document", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "Position", ";", "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", ";", "final", "class", "ASTRewriteFormatter", "{", "public", "static", "class", "NodeMarker", "extends", "Position", "{", "public", "Object", "data", ";", "}", "private", "class", "ExtendedFlattener", "extends", "ASTRewriteFlattener", "{", "private", "ArrayList", "positions", ";", "public", "ExtendedFlattener", "(", "RewriteEventStore", "store", ")", "{", "super", "(", "store", ")", ";", "this", ".", "positions", "=", "new", "ArrayList", "(", ")", ";", "}", "public", "void", "preVisit", "(", "ASTNode", "node", ")", "{", "Object", "trackData", "=", "getEventStore", "(", ")", ".", "getTrackedNodeData", "(", "node", ")", ";", "if", "(", "trackData", "!=", "null", ")", "{", "addMarker", "(", "trackData", ",", "this", ".", "result", ".", "length", "(", ")", ",", "0", ")", ";", "}", "Object", "placeholderData", "=", "getPlaceholders", "(", ")", ".", "getPlaceholderData", "(", "node", ")", ";", "if", "(", "placeholderData", "!=", "null", ")", "{", "addMarker", "(", "placeholderData", ",", "this", ".", "result", ".", "length", "(", ")", ",", "0", ")", ";", "}", "}", "public", "void", "postVisit", "(", "ASTNode", "node", ")", "{", "Object", "placeholderData", "=", "getPlaceholders", "(", ")", ".", "getPlaceholderData", "(", "node", ")", ";", "if", "(", "placeholderData", "!=", "null", ")", "{", "fixupLength", "(", "placeholderData", ",", "this", ".", "result", ".", "length", "(", ")", ")", ";", "}", "Object", "trackData", "=", "getEventStore", "(", ")", ".", "getTrackedNodeData", "(", "node", ")", ";", "if", "(", "trackData", "!=", "null", ")", "{", "fixupLength", "(", "trackData", ",", "this", ".", "result", ".", "length", "(", ")", ")", ";", "}", "}", "public", "boolean", "visit", "(", "Block", "node", ")", "{", "if", "(", "getPlaceholders", "(", ")", ".", "isCollapsed", "(", "node", ")", ")", "{", "visitList", "(", "node", ",", "Block", ".", "STATEMENTS_PROPERTY", ",", "null", ")", ";", "return", "false", ";", "}", "return", "super", ".", "visit", "(", "node", ")", ";", "}", "private", "NodeMarker", "addMarker", "(", "Object", "annotation", ",", "int", "startOffset", ",", "int", "length", ")", "{", "NodeMarker", "marker", "=", "new", "NodeMarker", "(", ")", ";", "marker", ".", "offset", "=", "startOffset", ";", "marker", ".", "length", "=", "length", ";", "marker", ".", "data", "=", "annotation", ";", "this", ".", "positions", ".", "add", "(", "marker", ")", ";", "return", "marker", ";", "}", "private", "void", "fixupLength", "(", "Object", "data", ",", "int", "endOffset", ")", "{", "for", "(", "int", "i", "=", "this", ".", "positions", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "NodeMarker", "marker", "=", "(", "NodeMarker", ")", "this", ".", "positions", ".", "get", "(", "i", ")", ";", "if", "(", "marker", ".", "data", "==", "data", ")", "{", "marker", ".", "length", "=", "endOffset", "-", "marker", ".", "offset", ";", "return", ";", "}", "}", "}", "public", "NodeMarker", "[", "]", "getMarkers", "(", ")", "{", "return", "(", "NodeMarker", "[", "]", ")", "this", ".", "positions", ".", "toArray", "(", "new", "NodeMarker", "[", "this", ".", "positions", ".", "size", "(", ")", "]", ")", ";", "}", "}", "private", "final", "String", "lineDelimiter", ";", "private", "final", "int", "tabWidth", ";", "private", "final", "int", "indentWidth", ";", "private", "final", "NodeInfoStore", "placeholders", ";", "private", "final", "RewriteEventStore", "eventStore", ";", "private", "final", "Map", "options", ";", "public", "ASTRewriteFormatter", "(", "NodeInfoStore", "placeholders", ",", "RewriteEventStore", "eventStore", ",", "Map", "options", ",", "String", "lineDelimiter", ")", "{", "this", ".", "placeholders", "=", "placeholders", ";", "this", ".", "eventStore", "=", "eventStore", ";", "this", ".", "options", "=", "options", "==", "null", "?", "JavaCore", ".", "getOptions", "(", ")", ":", "(", "Map", ")", "new", "HashMap", "(", "options", ")", ";", "this", ".", "options", ".", "put", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY", ",", "DefaultCodeFormatterConstants", ".", "createAlignmentValue", "(", "true", ",", "DefaultCodeFormatterConstants", ".", "WRAP_NEXT_PER_LINE", ",", "DefaultCodeFormatterConstants", ".", "INDENT_DEFAULT", ")", ")", ";", "this", ".", "lineDelimiter", "=", "lineDelimiter", ";", "this", ".", "tabWidth", "=", "IndentManipulation", ".", "getTabWidth", "(", "options", ")", ";", "this", ".", "indentWidth", "=", "IndentManipulation", ".", "getIndentWidth", "(", "options", ")", ";", "}", "public", "NodeInfoStore", "getPlaceholders", "(", ")", "{", "return", "this", ".", "placeholders", ";", "}", "public", "RewriteEventStore", "getEventStore", "(", ")", "{", "return", "this", ".", "eventStore", ";", "}", "public", "int", "getTabWidth", "(", ")", "{", "return", "this", ".", "tabWidth", ";", "}", "public", "int", "getIndentWidth", "(", ")", "{", "return", "this", ".", "indentWidth", ";", "}", "public", "String", "getLineDelimiter", "(", ")", "{", "return", "this", ".", "lineDelimiter", ";", "}", "public", "String", "getFormattedResult", "(", "ASTNode", "node", ",", "int", "initialIndentationLevel", ",", "Collection", "resultingMarkers", ")", "{", "ExtendedFlattener", "flattener", "=", "new", "ExtendedFlattener", "(", "this", ".", "eventStore", ")", ";", "node", ".", "accept", "(", "flattener", ")", ";", "NodeMarker", "[", "]", "markers", "=", "flattener", ".", "getMarkers", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "markers", ".", "length", ";", "i", "++", ")", "{", "resultingMarkers", ".", "add", "(", "markers", "[", "i", "]", ")", ";", "}", "String", "unformatted", "=", "flattener", ".", "getResult", "(", ")", ";", "TextEdit", "edit", "=", "formatNode", "(", "node", ",", "unformatted", ",", "initialIndentationLevel", ")", ";", "if", "(", "edit", "==", "null", ")", "{", "if", "(", "initialIndentationLevel", ">", "0", ")", "{", "String", "indentString", "=", "createIndentString", "(", "initialIndentationLevel", ")", ";", "ReplaceEdit", "[", "]", "edits", "=", "IndentManipulation", ".", "getChangeIndentEdits", "(", "unformatted", ",", "0", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ",", "indentString", ")", ";", "edit", "=", "new", "MultiTextEdit", "(", ")", ";", "edit", ".", "addChild", "(", "new", "InsertEdit", "(", "0", ",", "indentString", ")", ")", ";", "edit", ".", "addChildren", "(", "edits", ")", ";", "}", "else", "{", "return", "unformatted", ";", "}", "}", "return", "evaluateFormatterEdit", "(", "unformatted", ",", "edit", ",", "markers", ")", ";", "}", "public", "String", "createIndentString", "(", "int", "indentationUnits", ")", "{", "return", "ToolFactory", ".", "createCodeFormatter", "(", "this", ".", "options", ")", ".", "createIndentationString", "(", "indentationUnits", ")", ";", "}", "public", "String", "getIndentString", "(", "String", "currentLine", ")", "{", "return", "IndentManipulation", ".", "extractIndentString", "(", "currentLine", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ")", ";", "}", "public", "String", "changeIndent", "(", "String", "code", ",", "int", "codeIndentLevel", ",", "String", "newIndent", ")", "{", "return", "IndentManipulation", ".", "changeIndent", "(", "code", ",", "codeIndentLevel", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ",", "newIndent", ",", "this", ".", "lineDelimiter", ")", ";", "}", "public", "int", "computeIndentUnits", "(", "String", "line", ")", "{", "return", "IndentManipulation", ".", "measureIndentUnits", "(", "line", ",", "this", ".", "tabWidth", ",", "this", ".", "indentWidth", ")", ";", "}", "public", "static", "String", "evaluateFormatterEdit", "(", "String", "string", ",", "TextEdit", "edit", ",", "Position", "[", "]", "positions", ")", "{", "try", "{", "Document", "doc", "=", "createDocument", "(", "string", ",", "positions", ")", ";", "edit", ".", "apply", "(", "doc", ",", "0", ")", ";", "if", "(", "positions", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "positions", ".", "length", ";", "i", "++", ")", "{", "Assert", ".", "isTrue", "(", "!", "positions", "[", "i", "]", ".", "isDeleted", ",", "\"\"", ")", ";", "}", "}", "return", "doc", ".", "get", "(", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "Assert", ".", "isTrue", "(", "false", ",", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "TextEdit", "formatString", "(", "int", "kind", ",", "String", "string", ",", "int", "offset", ",", "int", "length", ",", "int", "indentationLevel", ")", "{", "return", "ToolFactory", ".", "createCodeFormatter", "(", "this", ".", "options", ")", ".", "format", "(", "kind", ",", "string", ",", "offset", ",", "length", ",", "indentationLevel", ",", "this", ".", "lineDelimiter", ")", ";", "}", "private", "TextEdit", "formatNode", "(", "ASTNode", "node", ",", "String", "str", ",", "int", "indentationLevel", ")", "{", "int", "code", ";", "String", "prefix", "=", "\"\"", ";", "String", "suffix", "=", "\"\"", ";", "if", "(", "node", "instanceof", "Statement", ")", "{", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "ASTNode", ".", "SWITCH_CASE", ")", "{", "prefix", "=", "\"switch(1)", "{\"", ";", "suffix", "=", "\"}\"", ";", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "}", "}", "else", "if", "(", "node", "instanceof", "Expression", "&&", "node", ".", "getNodeType", "(", ")", "!=", "ASTNode", ".", "VARIABLE_DECLARATION_EXPRESSION", ")", "{", "if", "(", "node", "instanceof", "Annotation", ")", "{", "suffix", "=", "\"nclass", "A", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "}", "else", "{", "code", "=", "CodeFormatter", ".", "K_EXPRESSION", ";", "}", "}", "else", "if", "(", "node", "instanceof", "BodyDeclaration", ")", "{", "code", "=", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ";", "}", "else", "{", "switch", "(", "node", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "ARRAY_TYPE", ":", "case", "ASTNode", ".", "PARAMETERIZED_TYPE", ":", "case", "ASTNode", ".", "PRIMITIVE_TYPE", ":", "case", "ASTNode", ".", "QUALIFIED_TYPE", ":", "case", "ASTNode", ".", "SIMPLE_TYPE", ":", "suffix", "=", "\"", "x;\"", ";", "code", "=", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ";", "break", ";", "case", "ASTNode", ".", "WILDCARD_TYPE", ":", "prefix", "=", "\"A<\"", ";", "suffix", "=", "\">", "x;\"", ";", "code", "=", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ";", "break", ";", "case", "ASTNode", ".", "COMPILATION_UNIT", ":", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_EXPRESSION", ":", "case", "ASTNode", ".", "SINGLE_VARIABLE_DECLARATION", ":", "suffix", "=", "\";\"", ";", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "break", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_FRAGMENT", ":", "prefix", "=", "\"A", "\"", ";", "suffix", "=", "\";\"", ";", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "break", ";", "case", "ASTNode", ".", "PACKAGE_DECLARATION", ":", "case", "ASTNode", ".", "IMPORT_DECLARATION", ":", "suffix", "=", "\"nclass", "A", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "JAVADOC", ":", "suffix", "=", "\"nclass", "A", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "CATCH_CLAUSE", ":", "prefix", "=", "\"try", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "break", ";", "case", "ASTNode", ".", "ANONYMOUS_CLASS_DECLARATION", ":", "prefix", "=", "\"new", "A()\"", ";", "suffix", "=", "\";\"", ";", "code", "=", "CodeFormatter", ".", "K_STATEMENTS", ";", "break", ";", "case", "ASTNode", ".", "MEMBER_VALUE_PAIR", ":", "prefix", "=", "\"@Author(\"", ";", "suffix", "=", "\")", "class", "x", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "MODIFIER", ":", "suffix", "=", "\"", "class", "x", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "TYPE_PARAMETER", ":", "prefix", "=", "\"class", "X<\"", ";", "suffix", "=", "\">", "{}\"", ";", "code", "=", "CodeFormatter", ".", "K_COMPILATION_UNIT", ";", "break", ";", "case", "ASTNode", ".", "MEMBER_REF", ":", "case", "ASTNode", ".", "METHOD_REF", ":", "case", "ASTNode", ".", "METHOD_REF_PARAMETER", ":", "case", "ASTNode", ".", "TAG_ELEMENT", ":", "case", "ASTNode", ".", "TEXT_ELEMENT", ":", "return", "null", ";", "default", ":", "return", "null", ";", "}", "}", "String", "concatStr", "=", "prefix", "+", "str", "+", "suffix", ";", "TextEdit", "edit", "=", "formatString", "(", "code", ",", "concatStr", ",", "prefix", ".", "length", "(", ")", ",", "str", ".", "length", "(", ")", ",", "indentationLevel", ")", ";", "if", "(", "prefix", ".", "length", "(", ")", ">", "0", ")", "{", "edit", "=", "shifEdit", "(", "edit", ",", "prefix", ".", "length", "(", ")", ")", ";", "}", "return", "edit", ";", "}", "private", "static", "TextEdit", "shifEdit", "(", "TextEdit", "oldEdit", ",", "int", "diff", ")", "{", "TextEdit", "newEdit", ";", "if", "(", "oldEdit", "instanceof", "ReplaceEdit", ")", "{", "ReplaceEdit", "edit", "=", "(", "ReplaceEdit", ")", "oldEdit", ";", "newEdit", "=", "new", "ReplaceEdit", "(", "edit", ".", "getOffset", "(", ")", "-", "diff", ",", "edit", ".", "getLength", "(", ")", ",", "edit", ".", "getText", "(", ")", ")", ";", "}", "else", "if", "(", "oldEdit", "instanceof", "InsertEdit", ")", "{", "InsertEdit", "edit", "=", "(", "InsertEdit", ")", "oldEdit", ";", "newEdit", "=", "new", "InsertEdit", "(", "edit", ".", "getOffset", "(", ")", "-", "diff", ",", "edit", ".", "getText", "(", ")", ")", ";", "}", "else", "if", "(", "oldEdit", "instanceof", "DeleteEdit", ")", "{", "DeleteEdit", "edit", "=", "(", "DeleteEdit", ")", "oldEdit", ";", "newEdit", "=", "new", "DeleteEdit", "(", "edit", ".", "getOffset", "(", ")", "-", "diff", ",", "edit", ".", "getLength", "(", ")", ")", ";", "}", "else", "if", "(", "oldEdit", "instanceof", "MultiTextEdit", ")", "{", "newEdit", "=", "new", "MultiTextEdit", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "TextEdit", "[", "]", "children", "=", "oldEdit", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "TextEdit", "shifted", "=", "shifEdit", "(", "children", "[", "i", "]", ",", "diff", ")", ";", "if", "(", "shifted", "!=", "null", ")", "{", "newEdit", ".", "addChild", "(", "shifted", ")", ";", "}", "}", "return", "newEdit", ";", "}", "private", "static", "Document", "createDocument", "(", "String", "string", ",", "Position", "[", "]", "positions", ")", "throws", "IllegalArgumentException", "{", "Document", "doc", "=", "new", "Document", "(", "string", ")", ";", "try", "{", "if", "(", "positions", "!=", "null", ")", "{", "final", "String", "POS_CATEGORY", "=", "\"myCategory\"", ";", "doc", ".", "addPositionCategory", "(", "POS_CATEGORY", ")", ";", "doc", ".", "addPositionUpdater", "(", "new", "DefaultPositionUpdater", "(", "POS_CATEGORY", ")", "{", "protected", "boolean", "notDeleted", "(", ")", "{", "int", "start", "=", "this", ".", "fOffset", ";", "int", "end", "=", "start", "+", "this", ".", "fLength", ";", "if", "(", "start", "<", "this", ".", "fPosition", ".", "offset", "&&", "(", "this", ".", "fPosition", ".", "offset", "+", "this", ".", "fPosition", ".", "length", "<", "end", ")", ")", "{", "this", ".", "fPosition", ".", "offset", "=", "end", ";", "return", "false", ";", "}", "return", "true", ";", "}", "}", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "positions", ".", "length", ";", "i", "++", ")", "{", "try", "{", "doc", ".", "addPosition", "(", "POS_CATEGORY", ",", "positions", "[", "i", "]", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "positions", "[", "i", "]", ".", "offset", "+", "\",", "length:", "\"", "+", "positions", "[", "i", "]", ".", "length", "+", "\"\"", "+", "string", ".", "length", "(", ")", ")", ";", "}", "}", "}", "}", "catch", "(", "BadPositionCategoryException", "cannotHappen", ")", "{", "}", "return", "doc", ";", "}", "public", "static", "interface", "Prefix", "{", "String", "getPrefix", "(", "int", "indent", ")", ";", "}", "public", "static", "interface", "BlockContext", "{", "String", "[", "]", "getPrefixAndSuffix", "(", "int", "indent", ",", "ASTNode", "node", ",", "RewriteEventStore", "events", ")", ";", "}", "public", "static", "class", "ConstPrefix", "implements", "Prefix", "{", "private", "String", "prefix", ";", "public", "ConstPrefix", "(", "String", "prefix", ")", "{", "this", ".", "prefix", "=", "prefix", ";", "}", "public", "String", "getPrefix", "(", "int", "indent", ")", "{", "return", "this", ".", "prefix", ";", "}", "}", "private", "class", "FormattingPrefix", "implements", "Prefix", "{", "private", "int", "kind", ";", "private", "String", "string", ";", "private", "int", "start", ";", "private", "int", "length", ";", "public", "FormattingPrefix", "(", "String", "string", ",", "String", "sub", ",", "int", "kind", ")", "{", "this", ".", "start", "=", "string", ".", "indexOf", "(", "sub", ")", ";", "this", ".", "length", "=", "sub", ".", "length", "(", ")", ";", "this", ".", "string", "=", "string", ";", "this", ".", "kind", "=", "kind", ";", "}", "public", "String", "getPrefix", "(", "int", "indent", ")", "{", "Position", "pos", "=", "new", "Position", "(", "this", ".", "start", ",", "this", ".", "length", ")", ";", "String", "str", "=", "this", ".", "string", ";", "TextEdit", "res", "=", "formatString", "(", "this", ".", "kind", ",", "str", ",", "0", ",", "str", ".", "length", "(", ")", ",", "indent", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "str", "=", "evaluateFormatterEdit", "(", "str", ",", "res", ",", "new", "Position", "[", "]", "{", "pos", "}", ")", ";", "}", "return", "str", ".", "substring", "(", "pos", ".", "offset", "+", "1", ",", "pos", ".", "offset", "+", "pos", ".", "length", "-", "1", ")", ";", "}", "}", "private", "class", "BlockFormattingPrefix", "implements", "BlockContext", "{", "private", "String", "prefix", ";", "private", "int", "start", ";", "public", "BlockFormattingPrefix", "(", "String", "prefix", ",", "int", "start", ")", "{", "this", ".", "start", "=", "start", ";", "this", ".", "prefix", "=", "prefix", ";", "}", "public", "String", "[", "]", "getPrefixAndSuffix", "(", "int", "indent", ",", "ASTNode", "node", ",", "RewriteEventStore", "events", ")", "{", "String", "nodeString", "=", "ASTRewriteFlattener", ".", "asString", "(", "node", ",", "events", ")", ";", "String", "str", "=", "this", ".", "prefix", "+", "nodeString", ";", "Position", "pos", "=", "new", "Position", "(", "this", ".", "start", ",", "this", ".", "prefix", ".", "length", "(", ")", "+", "1", "-", "this", ".", "start", ")", ";", "TextEdit", "res", "=", "formatString", "(", "CodeFormatter", ".", "K_STATEMENTS", ",", "str", ",", "0", ",", "str", ".", "length", "(", ")", ",", "indent", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "str", "=", "evaluateFormatterEdit", "(", "str", ",", "res", ",", "new", "Position", "[", "]", "{", "pos", "}", ")", ";", "}", "return", "new", "String", "[", "]", "{", "str", ".", "substring", "(", "pos", ".", "offset", "+", "1", ",", "pos", ".", "offset", "+", "pos", ".", "length", "-", "1", ")", ",", "\"\"", "}", ";", "}", "}", "private", "class", "BlockFormattingPrefixSuffix", "implements", "BlockContext", "{", "private", "String", "prefix", ";", "private", "String", "suffix", ";", "private", "int", "start", ";", "public", "BlockFormattingPrefixSuffix", "(", "String", "prefix", ",", "String", "suffix", ",", "int", "start", ")", "{", "this", ".", "start", "=", "start", ";", "this", ".", "suffix", "=", "suffix", ";", "this", ".", "prefix", "=", "prefix", ";", "}", "public", "String", "[", "]", "getPrefixAndSuffix", "(", "int", "indent", ",", "ASTNode", "node", ",", "RewriteEventStore", "events", ")", "{", "String", "nodeString", "=", "ASTRewriteFlattener", ".", "asString", "(", "node", ",", "events", ")", ";", "int", "nodeStart", "=", "this", ".", "prefix", ".", "length", "(", ")", ";", "int", "nodeEnd", "=", "nodeStart", "+", "nodeString", ".", "length", "(", ")", "-", "1", ";", "String", "str", "=", "this", ".", "prefix", "+", "nodeString", "+", "this", ".", "suffix", ";", "Position", "pos1", "=", "new", "Position", "(", "this", ".", "start", ",", "nodeStart", "+", "1", "-", "this", ".", "start", ")", ";", "Position", "pos2", "=", "new", "Position", "(", "nodeEnd", ",", "2", ")", ";", "TextEdit", "res", "=", "formatString", "(", "CodeFormatter", ".", "K_STATEMENTS", ",", "str", ",", "0", ",", "str", ".", "length", "(", ")", ",", "indent", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "str", "=", "evaluateFormatterEdit", "(", "str", ",", "res", ",", "new", "Position", "[", "]", "{", "pos1", ",", "pos2", "}", ")", ";", "}", "return", "new", "String", "[", "]", "{", "str", ".", "substring", "(", "pos1", ".", "offset", "+", "1", ",", "pos1", ".", "offset", "+", "pos1", ".", "length", "-", "1", ")", ",", "str", ".", "substring", "(", "pos2", ".", "offset", "+", "1", ",", "pos2", ".", "offset", "+", "pos2", ".", "length", "-", "1", ")", "}", ";", "}", "}", "public", "final", "static", "Prefix", "NONE", "=", "new", "ConstPrefix", "(", "\"\"", ")", ";", "public", "final", "static", "Prefix", "SPACE", "=", "new", "ConstPrefix", "(", "\"", "\"", ")", ";", "public", "final", "static", "Prefix", "ASSERT_COMMENT", "=", "new", "ConstPrefix", "(", "\"", ":", "\"", ")", ";", "public", "final", "Prefix", "VAR_INITIALIZER", "=", "new", "FormattingPrefix", "(", "\"A", "a={};\"", ",", "\"a={\"", ",", "CodeFormatter", ".", "K_STATEMENTS", ")", ";", "public", "final", "Prefix", "METHOD_BODY", "=", "new", "FormattingPrefix", "(", "\"void", "a()", "{}\"", ",", "\")", "{\"", ",", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ")", ";", "public", "final", "Prefix", "FINALLY_BLOCK", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"}", "finally", "{\"", ",", "CodeFormatter", ".", "K_STATEMENTS", ")", ";", "public", "final", "Prefix", "CATCH_BLOCK", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"}", "c\"", ",", "CodeFormatter", ".", "K_STATEMENTS", ")", ";", "public", "final", "Prefix", "ANNOT_MEMBER_DEFAULT", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\")", "default", "1\"", ",", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ")", ";", "public", "final", "Prefix", "ENUM_BODY_START", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"){v\"", ",", "CodeFormatter", ".", "K_COMPILATION_UNIT", ")", ";", "public", "final", "Prefix", "ENUM_BODY_END", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"}},\"", ",", "CodeFormatter", ".", "K_COMPILATION_UNIT", ")", ";", "public", "final", "Prefix", "WILDCARD_EXTENDS", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"?", "extends", "B\"", ",", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ")", ";", "public", "final", "Prefix", "WILDCARD_SUPER", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"?", "super", "B\"", ",", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ")", ";", "public", "final", "Prefix", "FIRST_ENUM_CONST", "=", "new", "FormattingPrefix", "(", "\"enum", "E", "{", "X;}\"", ",", "\"{", "X\"", ",", "CodeFormatter", ".", "K_COMPILATION_UNIT", ")", ";", "public", "final", "Prefix", "ANNOTATION_SEPARATION", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"A", "@\"", ",", "CodeFormatter", ".", "K_COMPILATION_UNIT", ")", ";", "public", "final", "Prefix", "PARAM_ANNOTATION_SEPARATION", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"A", "@\"", ",", "CodeFormatter", ".", "K_CLASS_BODY_DECLARATIONS", ")", ";", "public", "final", "Prefix", "TRY_RESOURCES", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\";", "B\"", ",", "CodeFormatter", ".", "K_STATEMENTS", ")", ";", "public", "final", "Prefix", "TRY_RESOURCES_PAREN", "=", "new", "FormattingPrefix", "(", "\"\"", ",", "\"y", "(\"", ",", "CodeFormatter", ".", "K_STATEMENTS", ")", ";", "public", "final", "BlockContext", "IF_BLOCK_WITH_ELSE", "=", "new", "BlockFormattingPrefixSuffix", "(", "\"if", "(true)\"", ",", "\"else{}\"", ",", "8", ")", ";", "public", "final", "BlockContext", "IF_BLOCK_NO_ELSE", "=", "new", "BlockFormattingPrefix", "(", "\"if", "(true)\"", ",", "8", ")", ";", "public", "final", "BlockContext", "ELSE_AFTER_STATEMENT", "=", "new", "BlockFormattingPrefix", "(", "\"\"", ",", "15", ")", ";", "public", "final", "BlockContext", "ELSE_AFTER_BLOCK", "=", "new", "BlockFormattingPrefix", "(", "\"\"", ",", "11", ")", ";", "public", "final", "BlockContext", "FOR_BLOCK", "=", "new", "BlockFormattingPrefix", "(", "\"for", "(;;)", "\"", ",", "7", ")", ";", "public", "final", "BlockContext", "WHILE_BLOCK", "=", "new", "BlockFormattingPrefix", "(", "\"while", "(true)\"", ",", "11", ")", ";", "public", "final", "BlockContext", "DO_BLOCK", "=", "new", "BlockFormattingPrefixSuffix", "(", "\"do", "\"", ",", "\"\"", ",", "1", ")", ";", "}", "</s>" ]
2,321
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "public", "class", "NodeRewriteEvent", "extends", "RewriteEvent", "{", "private", "Object", "originalValue", ";", "private", "Object", "newValue", ";", "public", "NodeRewriteEvent", "(", "Object", "originalValue", ",", "Object", "newValue", ")", "{", "this", ".", "originalValue", "=", "originalValue", ";", "this", ".", "newValue", "=", "newValue", ";", "}", "public", "Object", "getNewValue", "(", ")", "{", "return", "this", ".", "newValue", ";", "}", "public", "Object", "getOriginalValue", "(", ")", "{", "return", "this", ".", "originalValue", ";", "}", "public", "int", "getChangeKind", "(", ")", "{", "if", "(", "this", ".", "originalValue", "==", "this", ".", "newValue", ")", "{", "return", "UNCHANGED", ";", "}", "if", "(", "this", ".", "originalValue", "==", "null", ")", "{", "return", "INSERTED", ";", "}", "if", "(", "this", ".", "newValue", "==", "null", ")", "{", "return", "REMOVED", ";", "}", "if", "(", "this", ".", "originalValue", ".", "equals", "(", "this", ".", "newValue", ")", ")", "{", "return", "UNCHANGED", ";", "}", "return", "REPLACED", ";", "}", "public", "boolean", "isListRewrite", "(", ")", "{", "return", "false", ";", "}", "public", "void", "setNewValue", "(", "Object", "newValue", ")", "{", "this", ".", "newValue", "=", "newValue", ";", "}", "public", "RewriteEvent", "[", "]", "getChildren", "(", ")", "{", "return", "null", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "switch", "(", "getChangeKind", "(", ")", ")", "{", "case", "INSERTED", ":", "buf", ".", "append", "(", "\"", "[inserted:", "\"", ")", ";", "buf", ".", "append", "(", "getNewValue", "(", ")", ")", ";", "buf", ".", "append", "(", "']'", ")", ";", "break", ";", "case", "REPLACED", ":", "buf", ".", "append", "(", "\"", "[replaced:", "\"", ")", ";", "buf", ".", "append", "(", "getOriginalValue", "(", ")", ")", ";", "buf", ".", "append", "(", "\"", "->", "\"", ")", ";", "buf", ".", "append", "(", "getNewValue", "(", ")", ")", ";", "buf", ".", "append", "(", "']'", ")", ";", "break", ";", "case", "REMOVED", ":", "buf", ".", "append", "(", "\"", "[removed:", "\"", ")", ";", "buf", ".", "append", "(", "getOriginalValue", "(", ")", ")", ";", "buf", ".", "append", "(", "']'", ")", ";", "break", ";", "default", ":", "buf", ".", "append", "(", "\"", "[unchanged]\"", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,322
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "IdentityHashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Stack", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "TargetSourceRangeComputer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "TargetSourceRangeComputer", ".", "SourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "DefaultCodeFormatterConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "IndentManipulation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "RecoveryScanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "RecoveryScannerData", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "ScannerHelper", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewriteFormatter", ".", "BlockContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewriteFormatter", ".", "NodeMarker", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewriteFormatter", ".", "Prefix", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeInfoStore", ".", "CopyPlaceholderData", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeInfoStore", ".", "StringPlaceholderData", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "CopySourceInfo", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "CopySourceEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "CopyTargetEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "DeleteEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "InsertEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MoveSourceEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MoveTargetEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "RangeMarker", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "ReplaceEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "public", "final", "class", "ASTRewriteAnalyzer", "extends", "ASTVisitor", "{", "static", "final", "int", "JLS2_INTERNAL", "=", "AST", ".", "JLS2", ";", "static", "final", "int", "JLS3_INTERNAL", "=", "AST", ".", "JLS3", ";", "TextEdit", "currentEdit", ";", "final", "RewriteEventStore", "eventStore", ";", "private", "TokenScanner", "tokenScanner", ";", "private", "final", "Map", "sourceCopyInfoToEdit", ";", "private", "final", "Stack", "sourceCopyEndNodes", ";", "private", "final", "char", "[", "]", "content", ";", "private", "final", "LineInformation", "lineInfo", ";", "private", "final", "ASTRewriteFormatter", "formatter", ";", "private", "final", "NodeInfoStore", "nodeInfos", ";", "private", "final", "TargetSourceRangeComputer", "extendedSourceRangeComputer", ";", "private", "final", "LineCommentEndOffsets", "lineCommentEndOffsets", ";", "private", "int", "beforeRequiredSpaceIndex", "=", "-", "1", ";", "Map", "options", ";", "private", "RecoveryScannerData", "recoveryScannerData", ";", "public", "ASTRewriteAnalyzer", "(", "char", "[", "]", "content", ",", "LineInformation", "lineInfo", ",", "String", "lineDelim", ",", "TextEdit", "rootEdit", ",", "RewriteEventStore", "eventStore", ",", "NodeInfoStore", "nodeInfos", ",", "List", "comments", ",", "Map", "options", ",", "TargetSourceRangeComputer", "extendedSourceRangeComputer", ",", "RecoveryScannerData", "recoveryScannerData", ")", "{", "this", ".", "eventStore", "=", "eventStore", ";", "this", ".", "content", "=", "content", ";", "this", ".", "lineInfo", "=", "lineInfo", ";", "this", ".", "nodeInfos", "=", "nodeInfos", ";", "this", ".", "tokenScanner", "=", "null", ";", "this", ".", "currentEdit", "=", "rootEdit", ";", "this", ".", "sourceCopyInfoToEdit", "=", "new", "IdentityHashMap", "(", ")", ";", "this", ".", "sourceCopyEndNodes", "=", "new", "Stack", "(", ")", ";", "this", ".", "formatter", "=", "new", "ASTRewriteFormatter", "(", "nodeInfos", ",", "eventStore", ",", "options", ",", "lineDelim", ")", ";", "this", ".", "extendedSourceRangeComputer", "=", "extendedSourceRangeComputer", ";", "this", ".", "lineCommentEndOffsets", "=", "new", "LineCommentEndOffsets", "(", "comments", ")", ";", "this", ".", "options", "=", "options", ";", "this", ".", "recoveryScannerData", "=", "recoveryScannerData", ";", "}", "final", "TokenScanner", "getScanner", "(", ")", "{", "if", "(", "this", ".", "tokenScanner", "==", "null", ")", "{", "CompilerOptions", "compilerOptions", "=", "new", "CompilerOptions", "(", "this", ".", "options", ")", ";", "Scanner", "scanner", ";", "if", "(", "this", ".", "recoveryScannerData", "==", "null", ")", "{", "scanner", "=", "new", "Scanner", "(", "true", ",", "false", ",", "false", ",", "compilerOptions", ".", "sourceLevel", ",", "compilerOptions", ".", "complianceLevel", ",", "null", ",", "null", ",", "true", ")", ";", "}", "else", "{", "scanner", "=", "new", "RecoveryScanner", "(", "false", ",", "false", ",", "compilerOptions", ".", "sourceLevel", ",", "compilerOptions", ".", "complianceLevel", ",", "null", ",", "null", ",", "true", ",", "this", ".", "recoveryScannerData", ")", ";", "}", "scanner", ".", "setSource", "(", "this", ".", "content", ")", ";", "this", ".", "tokenScanner", "=", "new", "TokenScanner", "(", "scanner", ")", ";", "}", "return", "this", ".", "tokenScanner", ";", "}", "final", "char", "[", "]", "getContent", "(", ")", "{", "return", "this", ".", "content", ";", "}", "final", "LineInformation", "getLineInformation", "(", ")", "{", "return", "this", ".", "lineInfo", ";", "}", "final", "SourceRange", "getExtendedRange", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "eventStore", ".", "isRangeCopyPlaceholder", "(", "node", ")", ")", "{", "return", "new", "SourceRange", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ")", ";", "}", "return", "this", ".", "extendedSourceRangeComputer", ".", "computeSourceRange", "(", "node", ")", ";", "}", "final", "int", "getExtendedOffset", "(", "ASTNode", "node", ")", "{", "return", "getExtendedRange", "(", "node", ")", ".", "getStartPosition", "(", ")", ";", "}", "final", "int", "getExtendedEnd", "(", "ASTNode", "node", ")", "{", "TargetSourceRangeComputer", ".", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "return", "range", ".", "getStartPosition", "(", ")", "+", "range", ".", "getLength", "(", ")", ";", "}", "final", "TextEdit", "getCopySourceEdit", "(", "CopySourceInfo", "info", ")", "{", "TextEdit", "edit", "=", "(", "TextEdit", ")", "this", ".", "sourceCopyInfoToEdit", ".", "get", "(", "info", ")", ";", "if", "(", "edit", "==", "null", ")", "{", "SourceRange", "range", "=", "getExtendedRange", "(", "info", ".", "getNode", "(", ")", ")", ";", "int", "start", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "end", "=", "start", "+", "range", ".", "getLength", "(", ")", ";", "if", "(", "info", ".", "isMove", ")", "{", "MoveSourceEdit", "moveSourceEdit", "=", "new", "MoveSourceEdit", "(", "start", ",", "end", "-", "start", ")", ";", "moveSourceEdit", ".", "setTargetEdit", "(", "new", "MoveTargetEdit", "(", "0", ")", ")", ";", "edit", "=", "moveSourceEdit", ";", "}", "else", "{", "CopySourceEdit", "copySourceEdit", "=", "new", "CopySourceEdit", "(", "start", ",", "end", "-", "start", ")", ";", "copySourceEdit", ".", "setTargetEdit", "(", "new", "CopyTargetEdit", "(", "0", ")", ")", ";", "edit", "=", "copySourceEdit", ";", "}", "this", ".", "sourceCopyInfoToEdit", ".", "put", "(", "info", ",", "edit", ")", ";", "}", "return", "edit", ";", "}", "private", "final", "int", "getChangeKind", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "event", ".", "getChangeKind", "(", ")", ";", "}", "return", "RewriteEvent", ".", "UNCHANGED", ";", "}", "private", "final", "boolean", "hasChildrenChanges", "(", "ASTNode", "node", ")", "{", "return", "this", ".", "eventStore", ".", "hasChangedProperties", "(", "node", ")", ";", "}", "private", "final", "boolean", "isChanged", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ";", "}", "return", "false", ";", "}", "private", "final", "boolean", "isCollapsed", "(", "ASTNode", "node", ")", "{", "return", "this", ".", "nodeInfos", ".", "isCollapsed", "(", "node", ")", ";", "}", "final", "boolean", "isInsertBoundToPrevious", "(", "ASTNode", "node", ")", "{", "return", "this", ".", "eventStore", ".", "isInsertBoundToPrevious", "(", "node", ")", ";", "}", "private", "final", "TextEditGroup", "getEditGroup", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "getEditGroup", "(", "event", ")", ";", "}", "return", "null", ";", "}", "final", "RewriteEvent", "getEvent", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "return", "this", ".", "eventStore", ".", "getEvent", "(", "parent", ",", "property", ")", ";", "}", "final", "TextEditGroup", "getEditGroup", "(", "RewriteEvent", "change", ")", "{", "return", "this", ".", "eventStore", ".", "getEventEditGroup", "(", "change", ")", ";", "}", "private", "final", "Object", "getOriginalValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "return", "this", ".", "eventStore", ".", "getOriginalValue", "(", "parent", ",", "property", ")", ";", "}", "private", "final", "Object", "getNewValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "return", "this", ".", "eventStore", ".", "getNewValue", "(", "parent", ",", "property", ")", ";", "}", "final", "void", "addEdit", "(", "TextEdit", "edit", ")", "{", "this", ".", "currentEdit", ".", "addChild", "(", "edit", ")", ";", "}", "final", "String", "getLineDelimiter", "(", ")", "{", "return", "this", ".", "formatter", ".", "getLineDelimiter", "(", ")", ";", "}", "final", "String", "createIndentString", "(", "int", "indent", ")", "{", "return", "this", ".", "formatter", ".", "createIndentString", "(", "indent", ")", ";", "}", "final", "private", "String", "getIndentOfLine", "(", "int", "pos", ")", "{", "int", "line", "=", "getLineInformation", "(", ")", ".", "getLineOfOffset", "(", "pos", ")", ";", "if", "(", "line", ">=", "0", ")", "{", "char", "[", "]", "cont", "=", "getContent", "(", ")", ";", "int", "lineStart", "=", "getLineInformation", "(", ")", ".", "getLineOffset", "(", "line", ")", ";", "int", "i", "=", "lineStart", ";", "while", "(", "i", "<", "cont", ".", "length", "&&", "IndentManipulation", ".", "isIndentChar", "(", "this", ".", "content", "[", "i", "]", ")", ")", "{", "i", "++", ";", "}", "return", "new", "String", "(", "cont", ",", "lineStart", ",", "i", "-", "lineStart", ")", ";", "}", "return", "Util", ".", "EMPTY_STRING", ";", "}", "final", "String", "getIndentAtOffset", "(", "int", "pos", ")", "{", "return", "this", ".", "formatter", ".", "getIndentString", "(", "getIndentOfLine", "(", "pos", ")", ")", ";", "}", "final", "void", "doTextInsert", "(", "int", "offset", ",", "String", "insertString", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "insertString", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "this", ".", "lineCommentEndOffsets", ".", "isEndOfLineComment", "(", "offset", ",", "this", ".", "content", ")", ")", "{", "if", "(", "!", "insertString", ".", "startsWith", "(", "getLineDelimiter", "(", ")", ")", ")", "{", "TextEdit", "edit", "=", "new", "InsertEdit", "(", "offset", ",", "getLineDelimiter", "(", ")", ")", ";", "addEdit", "(", "edit", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "addEditGroup", "(", "editGroup", ",", "edit", ")", ";", "}", "}", "this", ".", "lineCommentEndOffsets", ".", "remove", "(", "offset", ")", ";", "}", "TextEdit", "edit", "=", "new", "InsertEdit", "(", "offset", ",", "insertString", ")", ";", "addEdit", "(", "edit", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "addEditGroup", "(", "editGroup", ",", "edit", ")", ";", "}", "}", "}", "final", "void", "addEditGroup", "(", "TextEditGroup", "editGroup", ",", "TextEdit", "edit", ")", "{", "editGroup", ".", "addTextEdit", "(", "edit", ")", ";", "}", "final", "TextEdit", "doTextRemove", "(", "int", "offset", ",", "int", "len", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "len", "==", "0", ")", "{", "return", "null", ";", "}", "TextEdit", "edit", "=", "new", "DeleteEdit", "(", "offset", ",", "len", ")", ";", "addEdit", "(", "edit", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "addEditGroup", "(", "editGroup", ",", "edit", ")", ";", "}", "return", "edit", ";", "}", "final", "void", "doTextRemoveAndVisit", "(", "int", "offset", ",", "int", "len", ",", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "TextEdit", "edit", "=", "doTextRemove", "(", "offset", ",", "len", ",", "editGroup", ")", ";", "if", "(", "edit", "!=", "null", ")", "{", "this", ".", "currentEdit", "=", "edit", ";", "voidVisit", "(", "node", ")", ";", "this", ".", "currentEdit", "=", "edit", ".", "getParent", "(", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ")", ";", "}", "}", "final", "int", "doVisit", "(", "ASTNode", "node", ")", "{", "node", ".", "accept", "(", "this", ")", ";", "return", "getExtendedEnd", "(", "node", ")", ";", "}", "private", "final", "int", "doVisit", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ")", "{", "Object", "node", "=", "getOriginalValue", "(", "parent", ",", "property", ")", ";", "if", "(", "property", ".", "isChildProperty", "(", ")", "&&", "node", "!=", "null", ")", "{", "return", "doVisit", "(", "(", "ASTNode", ")", "node", ")", ";", "}", "else", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "return", "doVisitList", "(", "(", "List", ")", "node", ",", "offset", ")", ";", "}", "return", "offset", ";", "}", "private", "int", "doVisitList", "(", "List", "list", ",", "int", "offset", ")", "{", "int", "endPos", "=", "offset", ";", "for", "(", "Iterator", "iter", "=", "list", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "curr", "=", "(", "(", "ASTNode", ")", "iter", ".", "next", "(", ")", ")", ";", "endPos", "=", "doVisit", "(", "curr", ")", ";", "}", "return", "endPos", ";", "}", "final", "void", "voidVisit", "(", "ASTNode", "node", ")", "{", "node", ".", "accept", "(", "this", ")", ";", "}", "private", "final", "void", "voidVisit", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "Object", "node", "=", "getOriginalValue", "(", "parent", ",", "property", ")", ";", "if", "(", "property", ".", "isChildProperty", "(", ")", "&&", "node", "!=", "null", ")", "{", "voidVisit", "(", "(", "ASTNode", ")", "node", ")", ";", "}", "else", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "voidVisitList", "(", "(", "List", ")", "node", ")", ";", "}", "}", "private", "void", "voidVisitList", "(", "List", "list", ")", "{", "for", "(", "Iterator", "iter", "=", "list", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "doVisit", "(", "(", "(", "ASTNode", ")", "iter", ".", "next", "(", ")", ")", ")", ";", "}", "}", "private", "final", "boolean", "doVisitUnchangedChildren", "(", "ASTNode", "parent", ")", "{", "List", "properties", "=", "parent", ".", "structuralPropertiesForType", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "properties", ".", "size", "(", ")", ";", "i", "++", ")", "{", "voidVisit", "(", "parent", ",", "(", "StructuralPropertyDescriptor", ")", "properties", ".", "get", "(", "i", ")", ")", ";", "}", "return", "false", ";", "}", "private", "final", "void", "doTextReplace", "(", "int", "offset", ",", "int", "len", ",", "String", "insertString", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "len", ">", "0", "||", "insertString", ".", "length", "(", ")", ">", "0", ")", "{", "TextEdit", "edit", "=", "new", "ReplaceEdit", "(", "offset", ",", "len", ",", "insertString", ")", ";", "addEdit", "(", "edit", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "addEditGroup", "(", "editGroup", ",", "edit", ")", ";", "}", "}", "}", "private", "final", "TextEdit", "doTextCopy", "(", "TextEdit", "sourceEdit", ",", "int", "destOffset", ",", "int", "sourceIndentLevel", ",", "String", "destIndentString", ",", "TextEditGroup", "editGroup", ")", "{", "TextEdit", "targetEdit", ";", "SourceModifier", "modifier", "=", "new", "SourceModifier", "(", "sourceIndentLevel", ",", "destIndentString", ",", "this", ".", "formatter", ".", "getTabWidth", "(", ")", ",", "this", ".", "formatter", ".", "getIndentWidth", "(", ")", ")", ";", "if", "(", "sourceEdit", "instanceof", "MoveSourceEdit", ")", "{", "MoveSourceEdit", "moveEdit", "=", "(", "MoveSourceEdit", ")", "sourceEdit", ";", "moveEdit", ".", "setSourceModifier", "(", "modifier", ")", ";", "targetEdit", "=", "new", "MoveTargetEdit", "(", "destOffset", ",", "moveEdit", ")", ";", "addEdit", "(", "targetEdit", ")", ";", "}", "else", "{", "CopySourceEdit", "copyEdit", "=", "(", "CopySourceEdit", ")", "sourceEdit", ";", "copyEdit", ".", "setSourceModifier", "(", "modifier", ")", ";", "targetEdit", "=", "new", "CopyTargetEdit", "(", "destOffset", ",", "copyEdit", ")", ";", "addEdit", "(", "targetEdit", ")", ";", "}", "if", "(", "editGroup", "!=", "null", ")", "{", "addEditGroup", "(", "editGroup", ",", "sourceEdit", ")", ";", "addEditGroup", "(", "editGroup", ",", "targetEdit", ")", ";", "}", "return", "targetEdit", ";", "}", "private", "void", "changeNotSupported", "(", "ASTNode", "node", ")", "{", "Assert", ".", "isTrue", "(", "false", ",", "\"\"", "+", "node", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "class", "ListRewriter", "{", "protected", "String", "constantSeparator", ";", "protected", "int", "startPos", ";", "protected", "RewriteEvent", "[", "]", "list", ";", "protected", "final", "ASTNode", "getOriginalNode", "(", "int", "index", ")", "{", "return", "(", "ASTNode", ")", "this", ".", "list", "[", "index", "]", ".", "getOriginalValue", "(", ")", ";", "}", "protected", "final", "ASTNode", "getNewNode", "(", "int", "index", ")", "{", "return", "(", "ASTNode", ")", "this", ".", "list", "[", "index", "]", ".", "getNewValue", "(", ")", ";", "}", "protected", "String", "getSeparatorString", "(", "int", "nodeIndex", ")", "{", "return", "this", ".", "constantSeparator", ";", "}", "protected", "int", "getInitialIndent", "(", ")", "{", "return", "getIndent", "(", "this", ".", "startPos", ")", ";", "}", "protected", "int", "getNodeIndent", "(", "int", "nodeIndex", ")", "{", "ASTNode", "node", "=", "getOriginalNode", "(", "nodeIndex", ")", ";", "if", "(", "node", "==", "null", ")", "{", "for", "(", "int", "i", "=", "nodeIndex", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "ASTNode", "curr", "=", "getOriginalNode", "(", "i", ")", ";", "if", "(", "curr", "!=", "null", ")", "{", "return", "getIndent", "(", "curr", ".", "getStartPosition", "(", ")", ")", ";", "}", "}", "return", "getInitialIndent", "(", ")", ";", "}", "return", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "}", "protected", "int", "getStartOfNextNode", "(", "int", "nextIndex", ",", "int", "defaultPos", ")", "{", "for", "(", "int", "i", "=", "nextIndex", ";", "i", "<", "this", ".", "list", ".", "length", ";", "i", "++", ")", "{", "RewriteEvent", "elem", "=", "this", ".", "list", "[", "i", "]", ";", "if", "(", "elem", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "INSERTED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "elem", ".", "getOriginalValue", "(", ")", ";", "return", "getExtendedOffset", "(", "node", ")", ";", "}", "}", "return", "defaultPos", ";", "}", "protected", "int", "getEndOfNode", "(", "ASTNode", "node", ")", "{", "return", "getExtendedEnd", "(", "node", ")", ";", "}", "public", "final", "int", "rewriteList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "String", "keyword", ",", "String", "separator", ")", "{", "this", ".", "constantSeparator", "=", "separator", ";", "return", "rewriteList", "(", "parent", ",", "property", ",", "keyword", ",", "null", ",", "offset", ")", ";", "}", "private", "boolean", "insertAfterSeparator", "(", "ASTNode", "node", ")", "{", "return", "!", "isInsertBoundToPrevious", "(", "node", ")", ";", "}", "protected", "boolean", "mustRemoveSeparator", "(", "int", "originalOffset", ",", "int", "nodeIndex", ")", "{", "return", "true", ";", "}", "private", "int", "rewriteList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "String", "keyword", ",", "String", "endKeyword", ",", "int", "offset", ")", "{", "this", ".", "startPos", "=", "offset", ";", "this", ".", "list", "=", "getEvent", "(", "parent", ",", "property", ")", ".", "getChildren", "(", ")", ";", "int", "total", "=", "this", ".", "list", ".", "length", ";", "if", "(", "total", "==", "0", ")", "{", "return", "this", ".", "startPos", ";", "}", "int", "currPos", "=", "-", "1", ";", "int", "lastNonInsert", "=", "-", "1", ";", "int", "lastNonDelete", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "total", ";", "i", "++", ")", "{", "int", "currMark", "=", "this", ".", "list", "[", "i", "]", ".", "getChangeKind", "(", ")", ";", "if", "(", "currMark", "!=", "RewriteEvent", ".", "INSERTED", ")", "{", "lastNonInsert", "=", "i", ";", "if", "(", "currPos", "==", "-", "1", ")", "{", "ASTNode", "elem", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "i", "]", ".", "getOriginalValue", "(", ")", ";", "currPos", "=", "getExtendedOffset", "(", "elem", ")", ";", "}", "}", "if", "(", "currMark", "!=", "RewriteEvent", ".", "REMOVED", ")", "{", "lastNonDelete", "=", "i", ";", "}", "}", "boolean", "insertNew", "=", "currPos", "==", "-", "1", ";", "if", "(", "insertNew", ")", "{", "if", "(", "keyword", ".", "length", "(", ")", ">", "0", ")", "{", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "this", ".", "list", "[", "0", "]", ")", ";", "doTextInsert", "(", "offset", ",", "keyword", ",", "editGroup", ")", ";", "}", "currPos", "=", "offset", ";", "}", "if", "(", "lastNonDelete", "==", "-", "1", ")", "{", "currPos", "=", "offset", ";", "}", "int", "prevEnd", "=", "currPos", ";", "int", "prevMark", "=", "RewriteEvent", ".", "UNCHANGED", ";", "final", "int", "NONE", "=", "0", ",", "NEW", "=", "1", ",", "EXISTING", "=", "2", ";", "int", "separatorState", "=", "NEW", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "total", ";", "i", "++", ")", "{", "RewriteEvent", "currEvent", "=", "this", ".", "list", "[", "i", "]", ";", "int", "currMark", "=", "currEvent", ".", "getChangeKind", "(", ")", ";", "int", "nextIndex", "=", "i", "+", "1", ";", "if", "(", "currMark", "==", "RewriteEvent", ".", "INSERTED", ")", "{", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "currEvent", ")", ";", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getNewValue", "(", ")", ";", "if", "(", "separatorState", "==", "NONE", ")", "{", "doTextInsert", "(", "currPos", ",", "getSeparatorString", "(", "i", "-", "1", ")", ",", "editGroup", ")", ";", "separatorState", "=", "NEW", ";", "}", "if", "(", "separatorState", "==", "NEW", "||", "insertAfterSeparator", "(", "node", ")", ")", "{", "if", "(", "separatorState", "==", "EXISTING", ")", "{", "updateIndent", "(", "prevMark", ",", "currPos", ",", "i", ",", "editGroup", ")", ";", "}", "doTextInsert", "(", "currPos", ",", "node", ",", "getNodeIndent", "(", "i", ")", ",", "true", ",", "editGroup", ")", ";", "separatorState", "=", "NEW", ";", "if", "(", "i", "!=", "lastNonDelete", ")", "{", "if", "(", "this", ".", "list", "[", "nextIndex", "]", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "INSERTED", ")", "{", "doTextInsert", "(", "currPos", ",", "getSeparatorString", "(", "i", ")", ",", "editGroup", ")", ";", "}", "else", "{", "separatorState", "=", "NONE", ";", "}", "}", "}", "else", "{", "doTextInsert", "(", "prevEnd", ",", "getSeparatorString", "(", "i", "-", "1", ")", ",", "editGroup", ")", ";", "doTextInsert", "(", "prevEnd", ",", "node", ",", "getNodeIndent", "(", "i", ")", ",", "true", ",", "editGroup", ")", ";", "}", "if", "(", "insertNew", ")", "{", "if", "(", "endKeyword", "!=", "null", "&&", "endKeyword", ".", "length", "(", ")", ">", "0", ")", "{", "doTextInsert", "(", "currPos", ",", "endKeyword", ",", "editGroup", ")", ";", "}", "}", "}", "else", "if", "(", "currMark", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "currEvent", ")", ";", "int", "currEnd", "=", "getEndOfNode", "(", "node", ")", ";", "try", "{", "TokenScanner", "scanner", "=", "getScanner", "(", ")", ";", "int", "newOffset", "=", "prevEnd", ";", "int", "extendedOffset", "=", "getExtendedOffset", "(", "node", ")", ";", "while", "(", "TokenScanner", ".", "isComment", "(", "scanner", ".", "readNext", "(", "newOffset", ",", "false", ")", ")", ")", "{", "int", "tempOffset", "=", "scanner", ".", "getNextEndOffset", "(", "newOffset", ",", "false", ")", ";", "if", "(", "tempOffset", "<", "extendedOffset", ")", "{", "newOffset", "=", "tempOffset", ";", "}", "else", "{", "break", ";", "}", "}", "if", "(", "currPos", "<", "newOffset", ")", "{", "currPos", "=", "extendedOffset", ";", "}", "prevEnd", "=", "newOffset", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "if", "(", "i", ">", "lastNonDelete", "&&", "separatorState", "==", "EXISTING", ")", "{", "doTextRemove", "(", "prevEnd", ",", "currPos", "-", "prevEnd", ",", "editGroup", ")", ";", "doTextRemoveAndVisit", "(", "currPos", ",", "currEnd", "-", "currPos", ",", "node", ",", "editGroup", ")", ";", "currPos", "=", "currEnd", ";", "prevEnd", "=", "currEnd", ";", "}", "else", "{", "if", "(", "i", "<", "lastNonDelete", ")", "{", "updateIndent", "(", "prevMark", ",", "currPos", ",", "i", ",", "editGroup", ")", ";", "}", "int", "end", "=", "getStartOfNextNode", "(", "nextIndex", ",", "currEnd", ")", ";", "try", "{", "TokenScanner", "scanner", "=", "getScanner", "(", ")", ";", "int", "nextToken", "=", "scanner", ".", "readNext", "(", "currEnd", ",", "false", ")", ";", "if", "(", "TokenScanner", ".", "isComment", "(", "nextToken", ")", ")", "{", "if", "(", "end", "!=", "scanner", ".", "getNextStartOffset", "(", "currEnd", ",", "false", ")", ")", "{", "end", "=", "currEnd", ";", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "doTextRemoveAndVisit", "(", "currPos", ",", "currEnd", "-", "currPos", ",", "node", ",", "getEditGroup", "(", "currEvent", ")", ")", ";", "if", "(", "mustRemoveSeparator", "(", "currPos", ",", "i", ")", ")", "{", "doTextRemove", "(", "currEnd", ",", "end", "-", "currEnd", ",", "editGroup", ")", ";", "}", "currPos", "=", "end", ";", "prevEnd", "=", "currEnd", ";", "separatorState", "=", "NEW", ";", "}", "}", "else", "{", "if", "(", "currMark", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getOriginalValue", "(", ")", ";", "int", "currEnd", "=", "getEndOfNode", "(", "node", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "currEvent", ")", ";", "ASTNode", "changed", "=", "(", "ASTNode", ")", "currEvent", ".", "getNewValue", "(", ")", ";", "updateIndent", "(", "prevMark", ",", "currPos", ",", "i", ",", "editGroup", ")", ";", "try", "{", "TokenScanner", "scanner", "=", "getScanner", "(", ")", ";", "int", "newOffset", "=", "prevEnd", ";", "int", "extendedOffset", "=", "getExtendedOffset", "(", "node", ")", ";", "while", "(", "TokenScanner", ".", "isComment", "(", "scanner", ".", "readNext", "(", "newOffset", ",", "false", ")", ")", ")", "{", "int", "tempOffset", "=", "scanner", ".", "getNextEndOffset", "(", "newOffset", ",", "false", ")", ";", "if", "(", "tempOffset", "<", "extendedOffset", ")", "{", "newOffset", "=", "tempOffset", ";", "}", "else", "{", "break", ";", "}", "}", "if", "(", "currPos", "<", "newOffset", ")", "{", "currPos", "=", "extendedOffset", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "doTextRemoveAndVisit", "(", "currPos", ",", "currEnd", "-", "currPos", ",", "node", ",", "editGroup", ")", ";", "doTextInsert", "(", "currPos", ",", "changed", ",", "getNodeIndent", "(", "i", ")", ",", "true", ",", "editGroup", ")", ";", "prevEnd", "=", "currEnd", ";", "}", "else", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getOriginalValue", "(", ")", ";", "voidVisit", "(", "node", ")", ";", "}", "if", "(", "i", "==", "lastNonInsert", ")", "{", "separatorState", "=", "NONE", ";", "if", "(", "currMark", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getOriginalValue", "(", ")", ";", "prevEnd", "=", "getEndOfNode", "(", "node", ")", ";", "}", "currPos", "=", "prevEnd", ";", "}", "else", "if", "(", "this", ".", "list", "[", "nextIndex", "]", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "if", "(", "currMark", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "currEvent", ".", "getOriginalValue", "(", ")", ";", "prevEnd", "=", "getEndOfNode", "(", "node", ")", ";", "}", "currPos", "=", "getStartOfNextNode", "(", "nextIndex", ",", "prevEnd", ")", ";", "separatorState", "=", "EXISTING", ";", "}", "}", "prevMark", "=", "currMark", ";", "}", "return", "currPos", ";", "}", "public", "final", "int", "rewriteList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "String", "keyword", ")", "{", "return", "rewriteList", "(", "parent", ",", "property", ",", "keyword", ",", "null", ",", "offset", ")", ";", "}", "protected", "void", "updateIndent", "(", "int", "prevMark", ",", "int", "originalOffset", ",", "int", "nodeIndex", ",", "TextEditGroup", "editGroup", ")", "{", "}", "public", "final", "int", "rewriteList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "String", "keyword", ",", "String", "endKeyword", ",", "String", "separator", ")", "{", "this", ".", "constantSeparator", "=", "separator", ";", "return", "rewriteList", "(", "parent", ",", "property", ",", "keyword", ",", "endKeyword", ",", "offset", ")", ";", "}", "}", "private", "int", "rewriteRequiredNode", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "int", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "length", ",", "node", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "getIndent", "(", "offset", ")", ",", "true", ",", "editGroup", ")", ";", "return", "offset", "+", "length", ";", "}", "return", "doVisit", "(", "parent", ",", "property", ",", "0", ")", ";", "}", "private", "int", "rewriteNode", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "Prefix", "prefix", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "switch", "(", "event", ".", "getChangeKind", "(", ")", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "int", "indent", "=", "getIndent", "(", "offset", ")", ";", "doTextInsert", "(", "offset", ",", "prefix", ".", "getPrefix", "(", "indent", ")", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "node", ",", "indent", ",", "true", ",", "editGroup", ")", ";", "return", "offset", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "int", "nodeEnd", ";", "int", "len", ";", "if", "(", "offset", "==", "0", ")", "{", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "len", "=", "range", ".", "getLength", "(", ")", ";", "nodeEnd", "=", "offset", "+", "len", ";", "}", "else", "{", "nodeEnd", "=", "getExtendedEnd", "(", "node", ")", ";", "len", "=", "nodeEnd", "-", "offset", ";", "}", "doTextRemoveAndVisit", "(", "offset", ",", "len", ",", "node", ",", "editGroup", ")", ";", "return", "nodeEnd", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "int", "nodeOffset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "nodeLen", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "nodeOffset", ",", "nodeLen", ",", "node", ",", "editGroup", ")", ";", "doTextInsert", "(", "nodeOffset", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "getIndent", "(", "offset", ")", ",", "true", ",", "editGroup", ")", ";", "return", "nodeOffset", "+", "nodeLen", ";", "}", "}", "}", "return", "doVisit", "(", "parent", ",", "property", ",", "offset", ")", ";", "}", "private", "int", "rewriteJavadoc", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "int", "pos", "=", "rewriteNode", "(", "node", ",", "property", ",", "node", ".", "getStartPosition", "(", ")", ",", "ASTRewriteFormatter", ".", "NONE", ")", ";", "int", "changeKind", "=", "getChangeKind", "(", "node", ",", "property", ")", ";", "if", "(", "changeKind", "==", "RewriteEvent", ".", "INSERTED", ")", "{", "String", "indent", "=", "getLineDelimiter", "(", ")", "+", "getIndentAtOffset", "(", "pos", ")", ";", "doTextInsert", "(", "pos", ",", "indent", ",", "getEditGroup", "(", "node", ",", "property", ")", ")", ";", "}", "else", "if", "(", "changeKind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "try", "{", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "false", ")", ";", "doTextRemove", "(", "pos", ",", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", "-", "pos", ",", "getEditGroup", "(", "node", ",", "property", ")", ")", ";", "pos", "=", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "return", "pos", ";", "}", "private", "int", "rewriteBodyNode", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "int", "endPos", ",", "int", "indent", ",", "BlockContext", "context", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "switch", "(", "event", ".", "getChangeKind", "(", ")", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "String", "[", "]", "strings", "=", "context", ".", "getPrefixAndSuffix", "(", "indent", ",", "node", ",", "this", ".", "eventStore", ")", ";", "doTextInsert", "(", "offset", ",", "strings", "[", "0", "]", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "node", ",", "indent", ",", "true", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "strings", "[", "1", "]", ",", "editGroup", ")", ";", "return", "offset", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "if", "(", "endPos", "==", "-", "1", ")", "{", "endPos", "=", "getExtendedEnd", "(", "node", ")", ";", "}", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "int", "len", "=", "endPos", "-", "offset", ";", "doTextRemoveAndVisit", "(", "offset", ",", "len", ",", "node", ",", "editGroup", ")", ";", "return", "endPos", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "boolean", "insertNewLine", "=", "false", ";", "if", "(", "endPos", "==", "-", "1", ")", "{", "int", "previousEnd", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "endPos", "=", "getExtendedEnd", "(", "node", ")", ";", "if", "(", "endPos", "!=", "previousEnd", ")", "{", "int", "token", "=", "TokenScanner", ".", "END_OF_FILE", ";", "try", "{", "token", "=", "getScanner", "(", ")", ".", "readNext", "(", "previousEnd", ",", "false", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "if", "(", "token", "==", "TerminalTokens", ".", "TokenNameCOMMENT_LINE", ")", "{", "insertNewLine", "=", "true", ";", "}", "}", "}", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "int", "nodeLen", "=", "endPos", "-", "offset", ";", "ASTNode", "replacingNode", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "String", "[", "]", "strings", "=", "context", ".", "getPrefixAndSuffix", "(", "indent", ",", "replacingNode", ",", "this", ".", "eventStore", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "nodeLen", ",", "node", ",", "editGroup", ")", ";", "String", "prefix", "=", "strings", "[", "0", "]", ";", "String", "insertedPrefix", "=", "prefix", ";", "if", "(", "insertNewLine", ")", "{", "insertedPrefix", "=", "getLineDelimiter", "(", ")", "+", "this", ".", "formatter", ".", "createIndentString", "(", "indent", ")", "+", "insertedPrefix", ".", "trim", "(", ")", "+", "'", "'", ";", "}", "doTextInsert", "(", "offset", ",", "insertedPrefix", ",", "editGroup", ")", ";", "int", "lineStart", "=", "getCurrentLineStart", "(", "prefix", ",", "prefix", ".", "length", "(", ")", ")", ";", "if", "(", "lineStart", "!=", "0", ")", "{", "indent", "=", "this", ".", "formatter", ".", "computeIndentUnits", "(", "prefix", ".", "substring", "(", "lineStart", ")", ")", ";", "}", "doTextInsert", "(", "offset", ",", "replacingNode", ",", "indent", ",", "true", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "strings", "[", "1", "]", ",", "editGroup", ")", ";", "return", "endPos", ";", "}", "}", "}", "int", "pos", "=", "doVisit", "(", "parent", ",", "property", ",", "offset", ")", ";", "if", "(", "endPos", "!=", "-", "1", ")", "{", "return", "endPos", ";", "}", "return", "pos", ";", "}", "private", "int", "rewriteOptionalQualifier", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "startPos", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "switch", "(", "event", ".", "getChangeKind", "(", ")", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "doTextInsert", "(", "startPos", ",", "node", ",", "getIndent", "(", "startPos", ")", ",", "true", ",", "editGroup", ")", ";", "doTextInsert", "(", "startPos", ",", "\".\"", ",", "editGroup", ")", ";", "return", "startPos", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "try", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "int", "dotEnd", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameDOT", ",", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ")", ";", "doTextRemoveAndVisit", "(", "startPos", ",", "dotEnd", "-", "startPos", ",", "node", ",", "editGroup", ")", ";", "return", "dotEnd", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "break", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "int", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "length", ",", "node", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "getIndent", "(", "startPos", ")", ",", "true", ",", "editGroup", ")", ";", "try", "{", "return", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameDOT", ",", "offset", "+", "length", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "break", ";", "}", "}", "}", "Object", "node", "=", "getOriginalValue", "(", "parent", ",", "property", ")", ";", "if", "(", "node", "==", "null", ")", "{", "return", "startPos", ";", "}", "int", "pos", "=", "doVisit", "(", "(", "ASTNode", ")", "node", ")", ";", "try", "{", "return", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameDOT", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "pos", ";", "}", "class", "ParagraphListRewriter", "extends", "ListRewriter", "{", "public", "final", "static", "int", "DEFAULT_SPACING", "=", "1", ";", "private", "int", "initialIndent", ";", "private", "int", "separatorLines", ";", "public", "ParagraphListRewriter", "(", "int", "initialIndent", ",", "int", "separator", ")", "{", "this", ".", "initialIndent", "=", "initialIndent", ";", "this", ".", "separatorLines", "=", "separator", ";", "}", "protected", "int", "getInitialIndent", "(", ")", "{", "return", "this", ".", "initialIndent", ";", "}", "protected", "String", "getSeparatorString", "(", "int", "nodeIndex", ")", "{", "return", "getSeparatorString", "(", "nodeIndex", ",", "nodeIndex", "+", "1", ")", ";", "}", "protected", "String", "getSeparatorString", "(", "int", "nodeIndex", ",", "int", "nextNodeIndex", ")", "{", "int", "newLines", "=", "this", ".", "separatorLines", "==", "-", "1", "?", "getNewLines", "(", "nodeIndex", ")", ":", "this", ".", "separatorLines", ";", "String", "lineDelim", "=", "getLineDelimiter", "(", ")", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "lineDelim", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newLines", ";", "i", "++", ")", "{", "buf", ".", "append", "(", "lineDelim", ")", ";", "}", "buf", ".", "append", "(", "createIndentString", "(", "getNodeIndent", "(", "nextNodeIndex", ")", ")", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "private", "ASTNode", "getNode", "(", "int", "nodeIndex", ")", "{", "ASTNode", "elem", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "nodeIndex", "]", ".", "getOriginalValue", "(", ")", ";", "if", "(", "elem", "==", "null", ")", "{", "elem", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "nodeIndex", "]", ".", "getNewValue", "(", ")", ";", "}", "return", "elem", ";", "}", "private", "int", "getNewLines", "(", "int", "nodeIndex", ")", "{", "ASTNode", "curr", "=", "getNode", "(", "nodeIndex", ")", ";", "ASTNode", "next", "=", "getNode", "(", "nodeIndex", "+", "1", ")", ";", "int", "currKind", "=", "curr", ".", "getNodeType", "(", ")", ";", "int", "nextKind", "=", "next", ".", "getNodeType", "(", ")", ";", "ASTNode", "last", "=", "null", ";", "ASTNode", "secondLast", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "list", ".", "length", ";", "i", "++", ")", "{", "ASTNode", "elem", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "i", "]", ".", "getOriginalValue", "(", ")", ";", "if", "(", "elem", "!=", "null", ")", "{", "if", "(", "last", "!=", "null", ")", "{", "if", "(", "elem", ".", "getNodeType", "(", ")", "==", "nextKind", "&&", "last", ".", "getNodeType", "(", ")", "==", "currKind", ")", "{", "return", "countEmptyLines", "(", "last", ")", ";", "}", "secondLast", "=", "last", ";", "}", "last", "=", "elem", ";", "}", "}", "if", "(", "currKind", "==", "ASTNode", ".", "FIELD_DECLARATION", "&&", "nextKind", "==", "ASTNode", ".", "FIELD_DECLARATION", ")", "{", "return", "0", ";", "}", "if", "(", "secondLast", "!=", "null", ")", "{", "return", "countEmptyLines", "(", "secondLast", ")", ";", "}", "return", "DEFAULT_SPACING", ";", "}", "private", "int", "countEmptyLines", "(", "ASTNode", "last", ")", "{", "LineInformation", "lineInformation", "=", "getLineInformation", "(", ")", ";", "int", "lastLine", "=", "lineInformation", ".", "getLineOfOffset", "(", "getExtendedEnd", "(", "last", ")", ")", ";", "if", "(", "lastLine", ">=", "0", ")", "{", "int", "startLine", "=", "lastLine", "+", "1", ";", "int", "start", "=", "lineInformation", ".", "getLineOffset", "(", "startLine", ")", ";", "if", "(", "start", "<", "0", ")", "{", "return", "0", ";", "}", "char", "[", "]", "cont", "=", "getContent", "(", ")", ";", "int", "i", "=", "start", ";", "while", "(", "i", "<", "cont", ".", "length", "&&", "ScannerHelper", ".", "isWhitespace", "(", "cont", "[", "i", "]", ")", ")", "{", "i", "++", ";", "}", "if", "(", "i", ">", "start", ")", "{", "lastLine", "=", "lineInformation", ".", "getLineOfOffset", "(", "i", ")", ";", "if", "(", "lastLine", ">", "startLine", ")", "{", "return", "lastLine", "-", "startLine", ";", "}", "}", "}", "return", "0", ";", "}", "protected", "boolean", "mustRemoveSeparator", "(", "int", "originalOffset", ",", "int", "nodeIndex", ")", "{", "int", "previousNonRemovedNodeIndex", "=", "nodeIndex", "-", "1", ";", "while", "(", "previousNonRemovedNodeIndex", ">=", "0", "&&", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "previousNonRemovedNodeIndex", "--", ";", "}", "if", "(", "previousNonRemovedNodeIndex", ">", "-", "1", ")", "{", "LineInformation", "lineInformation", "=", "getLineInformation", "(", ")", ";", "RewriteEvent", "prevEvent", "=", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ";", "int", "prevKind", "=", "prevEvent", ".", "getChangeKind", "(", ")", ";", "if", "(", "prevKind", "==", "RewriteEvent", ".", "UNCHANGED", "||", "prevKind", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ASTNode", "prevNode", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ".", "getOriginalValue", "(", ")", ";", "int", "prevEndPosition", "=", "prevNode", ".", "getStartPosition", "(", ")", "+", "prevNode", ".", "getLength", "(", ")", ";", "int", "prevLine", "=", "lineInformation", ".", "getLineOfOffset", "(", "prevEndPosition", ")", ";", "int", "line", "=", "lineInformation", ".", "getLineOfOffset", "(", "originalOffset", ")", ";", "if", "(", "prevLine", "==", "line", "&&", "nodeIndex", "+", "1", "<", "this", ".", "list", ".", "length", ")", "{", "RewriteEvent", "nextEvent", "=", "this", ".", "list", "[", "nodeIndex", "+", "1", "]", ";", "int", "nextKind", "=", "nextEvent", ".", "getChangeKind", "(", ")", ";", "if", "(", "nextKind", "==", "RewriteEvent", ".", "UNCHANGED", "||", "prevKind", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ASTNode", "nextNode", "=", "(", "ASTNode", ")", "nextEvent", ".", "getOriginalValue", "(", ")", ";", "int", "nextStartPosition", "=", "nextNode", ".", "getStartPosition", "(", ")", ";", "int", "nextLine", "=", "lineInformation", ".", "getLineOfOffset", "(", "nextStartPosition", ")", ";", "return", "nextLine", "==", "line", ";", "}", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}", "}", "private", "int", "rewriteParagraphList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "insertPos", ",", "int", "insertIndent", ",", "int", "separator", ",", "int", "lead", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "==", "null", "||", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "doVisit", "(", "parent", ",", "property", ",", "insertPos", ")", ";", "}", "RewriteEvent", "[", "]", "events", "=", "event", ".", "getChildren", "(", ")", ";", "ParagraphListRewriter", "listRewriter", "=", "new", "ParagraphListRewriter", "(", "insertIndent", ",", "separator", ")", ";", "StringBuffer", "leadString", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "isAllOfKind", "(", "events", ",", "RewriteEvent", ".", "INSERTED", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lead", ";", "i", "++", ")", "{", "leadString", ".", "append", "(", "getLineDelimiter", "(", ")", ")", ";", "}", "leadString", ".", "append", "(", "createIndentString", "(", "insertIndent", ")", ")", ";", "}", "return", "listRewriter", ".", "rewriteList", "(", "parent", ",", "property", ",", "insertPos", ",", "leadString", ".", "toString", "(", ")", ")", ";", "}", "private", "int", "rewriteOptionalTypeParameters", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ",", "String", "keyword", ",", "boolean", "adjustOnNext", ",", "boolean", "needsSpaceOnRemoveAll", ")", "{", "int", "pos", "=", "offset", ";", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "RewriteEvent", "[", "]", "children", "=", "event", ".", "getChildren", "(", ")", ";", "try", "{", "boolean", "isAllInserted", "=", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "INSERTED", ")", ";", "if", "(", "isAllInserted", "&&", "adjustOnNext", ")", "{", "pos", "=", "getScanner", "(", ")", ".", "getNextStartOffset", "(", "pos", ",", "false", ")", ";", "}", "boolean", "isAllRemoved", "=", "!", "isAllInserted", "&&", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "REMOVED", ")", ";", "if", "(", "isAllRemoved", ")", "{", "int", "posBeforeOpenBracket", "=", "getScanner", "(", ")", ".", "getTokenStartOffset", "(", "TerminalTokens", ".", "TokenNameLESS", ",", "pos", ")", ";", "if", "(", "posBeforeOpenBracket", "!=", "pos", ")", "{", "needsSpaceOnRemoveAll", "=", "false", ";", "}", "pos", "=", "posBeforeOpenBracket", ";", "}", "pos", "=", "new", "ListRewriter", "(", ")", ".", "rewriteList", "(", "parent", ",", "property", ",", "pos", ",", "String", ".", "valueOf", "(", "'<'", ")", ",", "\",", "\"", ")", ";", "if", "(", "isAllRemoved", ")", "{", "int", "endPos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameGREATER", ",", "pos", ")", ";", "endPos", "=", "getScanner", "(", ")", ".", "getNextStartOffset", "(", "endPos", ",", "false", ")", ";", "String", "replacement", "=", "needsSpaceOnRemoveAll", "?", "String", ".", "valueOf", "(", "'", "'", ")", ":", "Util", ".", "EMPTY_STRING", ";", "doTextReplace", "(", "pos", ",", "endPos", "-", "pos", ",", "replacement", ",", "getEditGroup", "(", "children", "[", "children", ".", "length", "-", "1", "]", ")", ")", ";", "return", "endPos", ";", "}", "else", "if", "(", "isAllInserted", ")", "{", "doTextInsert", "(", "pos", ",", "String", ".", "valueOf", "(", "'>'", "+", "keyword", ")", ",", "getEditGroup", "(", "children", "[", "children", ".", "length", "-", "1", "]", ")", ")", ";", "return", "pos", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "doVisit", "(", "parent", ",", "property", ",", "pos", ")", ";", "}", "if", "(", "pos", "!=", "offset", ")", "{", "try", "{", "return", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameGREATER", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "return", "pos", ";", "}", "private", "boolean", "isAllOfKind", "(", "RewriteEvent", "[", "]", "children", ",", "int", "kind", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "if", "(", "children", "[", "i", "]", ".", "getChangeKind", "(", ")", "!=", "kind", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "private", "int", "rewriteNodeList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "pos", ",", "String", "keyword", ",", "String", "endKeyword", ",", "String", "separator", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "new", "ListRewriter", "(", ")", ".", "rewriteList", "(", "parent", ",", "property", ",", "pos", ",", "keyword", ",", "endKeyword", ",", "separator", ")", ";", "}", "return", "doVisit", "(", "parent", ",", "property", ",", "pos", ")", ";", "}", "private", "int", "rewriteNodeList", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "pos", ",", "String", "keyword", ",", "String", "separator", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "new", "ListRewriter", "(", ")", ".", "rewriteList", "(", "parent", ",", "property", ",", "pos", ",", "keyword", ",", "separator", ")", ";", "}", "return", "doVisit", "(", "parent", ",", "property", ",", "pos", ")", ";", "}", "private", "void", "rewriteMethodBody", "(", "MethodDeclaration", "parent", ",", "int", "startPos", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "MethodDeclaration", ".", "BODY_PROPERTY", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "switch", "(", "event", ".", "getChangeKind", "(", ")", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "int", "endPos", "=", "parent", ".", "getStartPosition", "(", ")", "+", "parent", ".", "getLength", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "ASTNode", "body", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "doTextRemove", "(", "startPos", ",", "endPos", "-", "startPos", ",", "editGroup", ")", ";", "int", "indent", "=", "getIndent", "(", "parent", ".", "getStartPosition", "(", ")", ")", ";", "String", "prefix", "=", "this", ".", "formatter", ".", "METHOD_BODY", ".", "getPrefix", "(", "indent", ")", ";", "doTextInsert", "(", "startPos", ",", "prefix", ",", "editGroup", ")", ";", "doTextInsert", "(", "startPos", ",", "body", ",", "indent", ",", "true", ",", "editGroup", ")", ";", "return", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "ASTNode", "body", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "int", "endPos", "=", "parent", ".", "getStartPosition", "(", ")", "+", "parent", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "startPos", ",", "endPos", "-", "startPos", ",", "body", ",", "editGroup", ")", ";", "doTextInsert", "(", "startPos", ",", "\";\"", ",", "editGroup", ")", ";", "return", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "ASTNode", "body", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "doTextRemoveAndVisit", "(", "body", ".", "getStartPosition", "(", ")", ",", "body", ".", "getLength", "(", ")", ",", "body", ",", "editGroup", ")", ";", "doTextInsert", "(", "body", ".", "getStartPosition", "(", ")", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "getIndent", "(", "body", ".", "getStartPosition", "(", ")", ")", ",", "true", ",", "editGroup", ")", ";", "return", ";", "}", "}", "}", "voidVisit", "(", "parent", ",", "MethodDeclaration", ".", "BODY_PROPERTY", ")", ";", "}", "private", "int", "rewriteExtraDimensions", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "pos", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "==", "null", "||", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "(", "(", "Integer", ")", "getOriginalValue", "(", "parent", ",", "property", ")", ")", ".", "intValue", "(", ")", ";", "}", "int", "oldDim", "=", "(", "(", "Integer", ")", "event", ".", "getOriginalValue", "(", ")", ")", ".", "intValue", "(", ")", ";", "int", "newDim", "=", "(", "(", "Integer", ")", "event", ".", "getNewValue", "(", ")", ")", ".", "intValue", "(", ")", ";", "if", "(", "oldDim", "!=", "newDim", ")", "{", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "rewriteExtraDimensions", "(", "oldDim", ",", "newDim", ",", "pos", ",", "editGroup", ")", ";", "}", "return", "oldDim", ";", "}", "private", "void", "rewriteExtraDimensions", "(", "int", "oldDim", ",", "int", "newDim", ",", "int", "pos", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "oldDim", "<", "newDim", ")", "{", "for", "(", "int", "i", "=", "oldDim", ";", "i", "<", "newDim", ";", "i", "++", ")", "{", "doTextInsert", "(", "pos", ",", "\"[]\"", ",", "editGroup", ")", ";", "}", "}", "else", "if", "(", "newDim", "<", "oldDim", ")", "{", "try", "{", "getScanner", "(", ")", ".", "setOffset", "(", "pos", ")", ";", "for", "(", "int", "i", "=", "newDim", ";", "i", "<", "oldDim", ";", "i", "++", ")", "{", "getScanner", "(", ")", ".", "readToToken", "(", "TerminalTokens", ".", "TokenNameRBRACKET", ")", ";", "}", "doTextRemove", "(", "pos", ",", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", "-", "pos", ",", "editGroup", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "private", "int", "getPosAfterLeftBrace", "(", "int", "pos", ")", "{", "try", "{", "int", "nextToken", "=", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "true", ")", ";", "if", "(", "nextToken", "==", "TerminalTokens", ".", "TokenNameLBRACE", ")", "{", "return", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "pos", ";", "}", "private", "int", "getPosAfterTry", "(", "int", "pos", ")", "{", "try", "{", "int", "nextToken", "=", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "true", ")", ";", "if", "(", "nextToken", "==", "TerminalTokens", ".", "TokenNametry", ")", "{", "return", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "pos", ";", "}", "final", "int", "getIndent", "(", "int", "offset", ")", "{", "return", "this", ".", "formatter", ".", "computeIndentUnits", "(", "getIndentOfLine", "(", "offset", ")", ")", ";", "}", "final", "void", "doTextInsert", "(", "int", "insertOffset", ",", "ASTNode", "node", ",", "int", "initialIndentLevel", ",", "boolean", "removeLeadingIndent", ",", "TextEditGroup", "editGroup", ")", "{", "ArrayList", "markers", "=", "new", "ArrayList", "(", ")", ";", "String", "formatted", "=", "this", ".", "formatter", ".", "getFormattedResult", "(", "node", ",", "initialIndentLevel", ",", "markers", ")", ";", "int", "currPos", "=", "0", ";", "if", "(", "removeLeadingIndent", ")", "{", "while", "(", "currPos", "<", "formatted", ".", "length", "(", ")", "&&", "ScannerHelper", ".", "isWhitespace", "(", "formatted", ".", "charAt", "(", "currPos", ")", ")", ")", "{", "currPos", "++", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "markers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "NodeMarker", "curr", "=", "(", "NodeMarker", ")", "markers", ".", "get", "(", "i", ")", ";", "int", "offset", "=", "curr", ".", "offset", ";", "if", "(", "offset", ">=", "currPos", ")", "{", "String", "insertStr", "=", "formatted", ".", "substring", "(", "currPos", ",", "offset", ")", ";", "doTextInsert", "(", "insertOffset", ",", "insertStr", ",", "editGroup", ")", ";", "}", "else", "{", "continue", ";", "}", "Object", "data", "=", "curr", ".", "data", ";", "if", "(", "data", "instanceof", "TextEditGroup", ")", "{", "TextEdit", "edit", "=", "new", "RangeMarker", "(", "insertOffset", ",", "0", ")", ";", "addEditGroup", "(", "(", "TextEditGroup", ")", "data", ",", "edit", ")", ";", "addEdit", "(", "edit", ")", ";", "if", "(", "curr", ".", "length", "!=", "0", ")", "{", "int", "end", "=", "offset", "+", "curr", ".", "length", ";", "int", "k", "=", "i", "+", "1", ";", "while", "(", "k", "<", "markers", ".", "size", "(", ")", "&&", "(", "(", "NodeMarker", ")", "markers", ".", "get", "(", "k", ")", ")", ".", "offset", "<", "end", ")", "{", "k", "++", ";", "}", "curr", ".", "offset", "=", "end", ";", "curr", ".", "length", "=", "0", ";", "markers", ".", "add", "(", "k", ",", "curr", ")", ";", "}", "currPos", "=", "offset", ";", "}", "else", "{", "int", "lineOffset", "=", "getCurrentLineStart", "(", "formatted", ",", "offset", ")", ";", "String", "destIndentString", "=", "(", "lineOffset", "==", "0", ")", "?", "this", ".", "formatter", ".", "createIndentString", "(", "initialIndentLevel", ")", ":", "this", ".", "formatter", ".", "getIndentString", "(", "formatted", ".", "substring", "(", "lineOffset", ",", "offset", ")", ")", ";", "if", "(", "data", "instanceof", "CopyPlaceholderData", ")", "{", "CopySourceInfo", "copySource", "=", "(", "(", "CopyPlaceholderData", ")", "data", ")", ".", "copySource", ";", "int", "srcIndentLevel", "=", "getIndent", "(", "copySource", ".", "getNode", "(", ")", ".", "getStartPosition", "(", ")", ")", ";", "TextEdit", "sourceEdit", "=", "getCopySourceEdit", "(", "copySource", ")", ";", "doTextCopy", "(", "sourceEdit", ",", "insertOffset", ",", "srcIndentLevel", ",", "destIndentString", ",", "editGroup", ")", ";", "currPos", "=", "offset", "+", "curr", ".", "length", ";", "if", "(", "needsNewLineForLineComment", "(", "copySource", ".", "getNode", "(", ")", ",", "formatted", ",", "currPos", ")", ")", "{", "doTextInsert", "(", "insertOffset", ",", "getLineDelimiter", "(", ")", ",", "editGroup", ")", ";", "}", "}", "else", "if", "(", "data", "instanceof", "StringPlaceholderData", ")", "{", "String", "code", "=", "(", "(", "StringPlaceholderData", ")", "data", ")", ".", "code", ";", "String", "str", "=", "this", ".", "formatter", ".", "changeIndent", "(", "code", ",", "0", ",", "destIndentString", ")", ";", "doTextInsert", "(", "insertOffset", ",", "str", ",", "editGroup", ")", ";", "currPos", "=", "offset", "+", "curr", ".", "length", ";", "}", "}", "}", "if", "(", "currPos", "<", "formatted", ".", "length", "(", ")", ")", "{", "String", "insertStr", "=", "formatted", ".", "substring", "(", "currPos", ")", ";", "doTextInsert", "(", "insertOffset", ",", "insertStr", ",", "editGroup", ")", ";", "}", "}", "private", "boolean", "needsNewLineForLineComment", "(", "ASTNode", "node", ",", "String", "formatted", ",", "int", "offset", ")", "{", "if", "(", "!", "this", ".", "lineCommentEndOffsets", ".", "isEndOfLineComment", "(", "getExtendedEnd", "(", "node", ")", ",", "this", ".", "content", ")", ")", "{", "return", "false", ";", "}", "return", "offset", "<", "formatted", ".", "length", "(", ")", "&&", "!", "IndentManipulation", ".", "isLineDelimiterChar", "(", "formatted", ".", "charAt", "(", "offset", ")", ")", ";", "}", "private", "int", "getCurrentLineStart", "(", "String", "str", ",", "int", "pos", ")", "{", "for", "(", "int", "i", "=", "pos", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "char", "ch", "=", "str", ".", "charAt", "(", "i", ")", ";", "if", "(", "IndentManipulation", ".", "isLineDelimiterChar", "(", "ch", ")", ")", "{", "return", "i", "+", "1", ";", "}", "}", "return", "0", ";", "}", "private", "void", "rewriteModifiers", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "offset", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "==", "null", "||", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "REPLACED", ")", "{", "return", ";", "}", "try", "{", "int", "oldModifiers", "=", "(", "(", "Integer", ")", "event", ".", "getOriginalValue", "(", ")", ")", ".", "intValue", "(", ")", ";", "int", "newModifiers", "=", "(", "(", "Integer", ")", "event", ".", "getNewValue", "(", ")", ")", ".", "intValue", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "TokenScanner", "scanner", "=", "getScanner", "(", ")", ";", "int", "tok", "=", "scanner", ".", "readNext", "(", "offset", ",", "false", ")", ";", "int", "startPos", "=", "scanner", ".", "getCurrentStartOffset", "(", ")", ";", "int", "nextStart", "=", "startPos", ";", "loop", ":", "while", "(", "true", ")", "{", "if", "(", "TokenScanner", ".", "isComment", "(", "tok", ")", ")", "{", "tok", "=", "scanner", ".", "readNext", "(", "true", ")", ";", "}", "boolean", "keep", "=", "true", ";", "switch", "(", "tok", ")", "{", "case", "TerminalTokens", ".", "TokenNamepublic", ":", "keep", "=", "Modifier", ".", "isPublic", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameprotected", ":", "keep", "=", "Modifier", ".", "isProtected", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameprivate", ":", "keep", "=", "Modifier", ".", "isPrivate", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamestatic", ":", "keep", "=", "Modifier", ".", "isStatic", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamefinal", ":", "keep", "=", "Modifier", ".", "isFinal", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameabstract", ":", "keep", "=", "Modifier", ".", "isAbstract", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamenative", ":", "keep", "=", "Modifier", ".", "isNative", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamevolatile", ":", "keep", "=", "Modifier", ".", "isVolatile", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamestrictfp", ":", "keep", "=", "Modifier", ".", "isStrictfp", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNametransient", ":", "keep", "=", "Modifier", ".", "isTransient", "(", "newModifiers", ")", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNamesynchronized", ":", "keep", "=", "Modifier", ".", "isSynchronized", "(", "newModifiers", ")", ";", "break", ";", "default", ":", "break", "loop", ";", "}", "tok", "=", "getScanner", "(", ")", ".", "readNext", "(", "false", ")", ";", "int", "currPos", "=", "nextStart", ";", "nextStart", "=", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ";", "if", "(", "!", "keep", ")", "{", "doTextRemove", "(", "currPos", ",", "nextStart", "-", "currPos", ",", "editGroup", ")", ";", "}", "}", "int", "addedModifiers", "=", "newModifiers", "&", "~", "oldModifiers", ";", "if", "(", "addedModifiers", "!=", "0", ")", "{", "if", "(", "startPos", "!=", "nextStart", ")", "{", "int", "visibilityModifiers", "=", "addedModifiers", "&", "(", "Modifier", ".", "PUBLIC", "|", "Modifier", ".", "PRIVATE", "|", "Modifier", ".", "PROTECTED", ")", ";", "if", "(", "visibilityModifiers", "!=", "0", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "ASTRewriteFlattener", ".", "printModifiers", "(", "visibilityModifiers", ",", "buf", ")", ";", "doTextInsert", "(", "startPos", ",", "buf", ".", "toString", "(", ")", ",", "editGroup", ")", ";", "addedModifiers", "&=", "~", "visibilityModifiers", ";", "}", "}", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "ASTRewriteFlattener", ".", "printModifiers", "(", "addedModifiers", ",", "buf", ")", ";", "doTextInsert", "(", "nextStart", ",", "buf", ".", "toString", "(", ")", ",", "editGroup", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "class", "ModifierRewriter", "extends", "ListRewriter", "{", "private", "final", "Prefix", "annotationSeparation", ";", "public", "ModifierRewriter", "(", "Prefix", "annotationSeparation", ")", "{", "this", ".", "annotationSeparation", "=", "annotationSeparation", ";", "}", "protected", "String", "getSeparatorString", "(", "int", "nodeIndex", ")", "{", "ASTNode", "curr", "=", "getNewNode", "(", "nodeIndex", ")", ";", "if", "(", "curr", "instanceof", "Annotation", ")", "{", "return", "this", ".", "annotationSeparation", ".", "getPrefix", "(", "getNodeIndent", "(", "nodeIndex", "+", "1", ")", ")", ";", "}", "return", "super", ".", "getSeparatorString", "(", "nodeIndex", ")", ";", "}", "}", "private", "int", "rewriteModifiers2", "(", "ASTNode", "node", ",", "ChildListPropertyDescriptor", "property", ",", "int", "pos", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "property", ")", ";", "if", "(", "event", "==", "null", "||", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "doVisit", "(", "node", ",", "property", ",", "pos", ")", ";", "}", "RewriteEvent", "[", "]", "children", "=", "event", ".", "getChildren", "(", ")", ";", "boolean", "isAllInsert", "=", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "INSERTED", ")", ";", "boolean", "isAllRemove", "=", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "REMOVED", ")", ";", "if", "(", "isAllInsert", "||", "isAllRemove", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getNextStartOffset", "(", "pos", ",", "false", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "Prefix", "formatterPrefix", ";", "if", "(", "property", "==", "SingleVariableDeclaration", ".", "MODIFIERS2_PROPERTY", ")", "formatterPrefix", "=", "this", ".", "formatter", ".", "PARAM_ANNOTATION_SEPARATION", ";", "else", "formatterPrefix", "=", "this", ".", "formatter", ".", "ANNOTATION_SEPARATION", ";", "int", "endPos", "=", "new", "ModifierRewriter", "(", "formatterPrefix", ")", ".", "rewriteList", "(", "node", ",", "property", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\"", "\"", ")", ";", "try", "{", "int", "nextPos", "=", "getScanner", "(", ")", ".", "getNextStartOffset", "(", "endPos", ",", "false", ")", ";", "boolean", "lastUnchanged", "=", "children", "[", "children", ".", "length", "-", "1", "]", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ";", "if", "(", "isAllRemove", ")", "{", "doTextRemove", "(", "endPos", ",", "nextPos", "-", "endPos", ",", "getEditGroup", "(", "children", "[", "children", ".", "length", "-", "1", "]", ")", ")", ";", "return", "nextPos", ";", "}", "else", "if", "(", "isAllInsert", "||", "(", "nextPos", "==", "endPos", "&&", "lastUnchanged", ")", ")", "{", "RewriteEvent", "lastChild", "=", "children", "[", "children", ".", "length", "-", "1", "]", ";", "String", "separator", ";", "if", "(", "lastChild", ".", "getNewValue", "(", ")", "instanceof", "Annotation", ")", "{", "separator", "=", "formatterPrefix", ".", "getPrefix", "(", "getIndent", "(", "pos", ")", ")", ";", "}", "else", "{", "separator", "=", "String", ".", "valueOf", "(", "'", "'", ")", ";", "}", "doTextInsert", "(", "endPos", ",", "separator", ",", "getEditGroup", "(", "lastChild", ")", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "endPos", ";", "}", "private", "void", "replaceOperation", "(", "int", "posBeforeOperation", ",", "String", "newOperation", ",", "TextEditGroup", "editGroup", ")", "{", "try", "{", "getScanner", "(", ")", ".", "readNext", "(", "posBeforeOperation", ",", "true", ")", ";", "doTextReplace", "(", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ",", "getScanner", "(", ")", ".", "getCurrentLength", "(", ")", ",", "newOperation", ",", "editGroup", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "private", "void", "rewriteOperation", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "int", "posBeforeOperation", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "try", "{", "String", "newOperation", "=", "event", ".", "getNewValue", "(", ")", ".", "toString", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "getScanner", "(", ")", ".", "readNext", "(", "posBeforeOperation", ",", "true", ")", ";", "doTextReplace", "(", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ",", "getScanner", "(", ")", ".", "getCurrentLength", "(", ")", ",", "newOperation", ",", "editGroup", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "public", "void", "postVisit", "(", "ASTNode", "node", ")", "{", "TextEditGroup", "editGroup", "=", "this", ".", "eventStore", ".", "getTrackedNodeData", "(", "node", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "this", ".", "currentEdit", "=", "this", ".", "currentEdit", ".", "getParent", "(", ")", ";", "}", "doCopySourcePostVisit", "(", "node", ",", "this", ".", "sourceCopyEndNodes", ")", ";", "}", "public", "void", "preVisit", "(", "ASTNode", "node", ")", "{", "CopySourceInfo", "[", "]", "infos", "=", "this", ".", "eventStore", ".", "getNodeCopySources", "(", "node", ")", ";", "doCopySourcePreVisit", "(", "infos", ",", "this", ".", "sourceCopyEndNodes", ")", ";", "TextEditGroup", "editGroup", "=", "this", ".", "eventStore", ".", "getTrackedNodeData", "(", "node", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "SourceRange", "range", "=", "getExtendedRange", "(", "node", ")", ";", "int", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "TextEdit", "edit", "=", "new", "RangeMarker", "(", "offset", ",", "length", ")", ";", "addEditGroup", "(", "editGroup", ",", "edit", ")", ";", "addEdit", "(", "edit", ")", ";", "this", ".", "currentEdit", "=", "edit", ";", "}", "ensureSpaceBeforeReplace", "(", "node", ")", ";", "}", "final", "void", "doCopySourcePreVisit", "(", "CopySourceInfo", "[", "]", "infos", ",", "Stack", "nodeEndStack", ")", "{", "if", "(", "infos", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "infos", ".", "length", ";", "i", "++", ")", "{", "CopySourceInfo", "curr", "=", "infos", "[", "i", "]", ";", "TextEdit", "edit", "=", "getCopySourceEdit", "(", "curr", ")", ";", "addEdit", "(", "edit", ")", ";", "this", ".", "currentEdit", "=", "edit", ";", "nodeEndStack", ".", "push", "(", "curr", ".", "getNode", "(", ")", ")", ";", "}", "}", "}", "final", "void", "doCopySourcePostVisit", "(", "ASTNode", "node", ",", "Stack", "nodeEndStack", ")", "{", "while", "(", "!", "nodeEndStack", ".", "isEmpty", "(", ")", "&&", "nodeEndStack", ".", "peek", "(", ")", "==", "node", ")", "{", "nodeEndStack", ".", "pop", "(", ")", ";", "this", ".", "currentEdit", "=", "this", ".", "currentEdit", ".", "getParent", "(", ")", ";", "}", "}", "public", "boolean", "visit", "(", "CompilationUnit", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "startPos", "=", "rewriteNode", "(", "node", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ",", "0", ",", "ASTRewriteFormatter", ".", "NONE", ")", ";", "if", "(", "getChangeKind", "(", "node", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ")", "==", "RewriteEvent", ".", "INSERTED", ")", "{", "doTextInsert", "(", "0", ",", "getLineDelimiter", "(", ")", ",", "getEditGroup", "(", "node", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ")", ")", ";", "}", "startPos", "=", "rewriteParagraphList", "(", "node", ",", "CompilationUnit", ".", "IMPORTS_PROPERTY", ",", "startPos", ",", "0", ",", "0", ",", "2", ")", ";", "rewriteParagraphList", "(", "node", ",", "CompilationUnit", ".", "TYPES_PROPERTY", ",", "startPos", ",", "0", ",", "-", "1", ",", "2", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "apiLevel", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ";", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "TypeDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "boolean", "isJLS2", "=", "apiLevel", "==", "JLS2_INTERNAL", ";", "if", "(", "isJLS2", ")", "{", "rewriteModifiers", "(", "node", ",", "TypeDeclaration", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "TypeDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "boolean", "isInterface", "=", "(", "(", "Boolean", ")", "getOriginalValue", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ")", ".", "booleanValue", "(", ")", ";", "boolean", "invertType", "=", "isChanged", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ";", "if", "(", "invertType", ")", "{", "try", "{", "int", "typeToken", "=", "isInterface", "?", "TerminalTokens", ".", "TokenNameinterface", ":", "TerminalTokens", ".", "TokenNameclass", ";", "int", "startPosition", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "!", "isJLS2", ")", "{", "List", "modifiers", "=", "node", ".", "modifiers", "(", ")", ";", "final", "int", "size", "=", "modifiers", ".", "size", "(", ")", ";", "if", "(", "size", "!=", "0", ")", "{", "ASTNode", "modifierNode", "=", "(", "ASTNode", ")", "modifiers", ".", "get", "(", "size", "-", "1", ")", ";", "startPosition", "=", "modifierNode", ".", "getStartPosition", "(", ")", "+", "modifierNode", ".", "getLength", "(", ")", ";", "}", "}", "getScanner", "(", ")", ".", "readToToken", "(", "typeToken", ",", "startPosition", ")", ";", "String", "str", "=", "isInterface", "?", "\"class\"", ":", "\"interface\"", ";", "int", "start", "=", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ";", "int", "end", "=", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "doTextReplace", "(", "start", ",", "end", "-", "start", ",", "str", ",", "getEditGroup", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "TypeDeclaration", ".", "NAME_PROPERTY", ")", ";", "if", "(", "!", "isJLS2", ")", "{", "pos", "=", "rewriteOptionalTypeParameters", "(", "node", ",", "TypeDeclaration", ".", "TYPE_PARAMETERS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "false", ",", "true", ")", ";", "}", "if", "(", "!", "isInterface", "||", "invertType", ")", "{", "ChildPropertyDescriptor", "superClassProperty", "=", "isJLS2", "?", "TypeDeclaration", ".", "SUPERCLASS_PROPERTY", ":", "TypeDeclaration", ".", "SUPERCLASS_TYPE_PROPERTY", ";", "RewriteEvent", "superClassEvent", "=", "getEvent", "(", "node", ",", "superClassProperty", ")", ";", "int", "changeKind", "=", "superClassEvent", "!=", "null", "?", "superClassEvent", ".", "getChangeKind", "(", ")", ":", "RewriteEvent", ".", "UNCHANGED", ";", "switch", "(", "changeKind", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "doTextInsert", "(", "pos", ",", "\"", "extends", "\"", ",", "getEditGroup", "(", "superClassEvent", ")", ")", ";", "doTextInsert", "(", "pos", ",", "(", "ASTNode", ")", "superClassEvent", ".", "getNewValue", "(", ")", ",", "0", ",", "false", ",", "getEditGroup", "(", "superClassEvent", ")", ")", ";", "break", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "ASTNode", "superClass", "=", "(", "ASTNode", ")", "superClassEvent", ".", "getOriginalValue", "(", ")", ";", "int", "endPos", "=", "getExtendedEnd", "(", "superClass", ")", ";", "doTextRemoveAndVisit", "(", "pos", ",", "endPos", "-", "pos", ",", "superClass", ",", "getEditGroup", "(", "superClassEvent", ")", ")", ";", "pos", "=", "endPos", ";", "break", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "ASTNode", "superClass", "=", "(", "ASTNode", ")", "superClassEvent", ".", "getOriginalValue", "(", ")", ";", "SourceRange", "range", "=", "getExtendedRange", "(", "superClass", ")", ";", "int", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "length", ",", "superClass", ",", "getEditGroup", "(", "superClassEvent", ")", ")", ";", "doTextInsert", "(", "offset", ",", "(", "ASTNode", ")", "superClassEvent", ".", "getNewValue", "(", ")", ",", "0", ",", "false", ",", "getEditGroup", "(", "superClassEvent", ")", ")", ";", "pos", "=", "offset", "+", "length", ";", "break", ";", "}", "case", "RewriteEvent", ".", "UNCHANGED", ":", "{", "pos", "=", "doVisit", "(", "node", ",", "superClassProperty", ",", "pos", ")", ";", "}", "}", "}", "ChildListPropertyDescriptor", "superInterfaceProperty", "=", "isJLS2", "?", "TypeDeclaration", ".", "SUPER_INTERFACES_PROPERTY", ":", "TypeDeclaration", ".", "SUPER_INTERFACE_TYPES_PROPERTY", ";", "RewriteEvent", "interfaceEvent", "=", "getEvent", "(", "node", ",", "superInterfaceProperty", ")", ";", "if", "(", "interfaceEvent", "==", "null", "||", "interfaceEvent", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "if", "(", "invertType", ")", "{", "List", "originalNodes", "=", "(", "List", ")", "getOriginalValue", "(", "node", ",", "superInterfaceProperty", ")", ";", "if", "(", "!", "originalNodes", ".", "isEmpty", "(", ")", ")", "{", "String", "keyword", "=", "isInterface", "?", "\"", "implements", "\"", ":", "\"", "extends", "\"", ";", "ASTNode", "firstNode", "=", "(", "ASTNode", ")", "originalNodes", ".", "get", "(", "0", ")", ";", "doTextReplace", "(", "pos", ",", "firstNode", ".", "getStartPosition", "(", ")", "-", "pos", ",", "keyword", ",", "getEditGroup", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ")", ";", "}", "}", "pos", "=", "doVisit", "(", "node", ",", "superInterfaceProperty", ",", "pos", ")", ";", "}", "else", "{", "String", "keyword", "=", "(", "isInterface", "==", "invertType", ")", "?", "\"", "implements", "\"", ":", "\"", "extends", "\"", ";", "if", "(", "invertType", ")", "{", "List", "newNodes", "=", "(", "List", ")", "interfaceEvent", ".", "getNewValue", "(", ")", ";", "if", "(", "!", "newNodes", ".", "isEmpty", "(", ")", ")", "{", "List", "origNodes", "=", "(", "List", ")", "interfaceEvent", ".", "getOriginalValue", "(", ")", ";", "int", "firstStart", "=", "pos", ";", "if", "(", "!", "origNodes", ".", "isEmpty", "(", ")", ")", "{", "firstStart", "=", "(", "(", "ASTNode", ")", "origNodes", ".", "get", "(", "0", ")", ")", ".", "getStartPosition", "(", ")", ";", "}", "doTextReplace", "(", "pos", ",", "firstStart", "-", "pos", ",", "keyword", ",", "getEditGroup", "(", "node", ",", "TypeDeclaration", ".", "INTERFACE_PROPERTY", ")", ")", ";", "keyword", "=", "Util", ".", "EMPTY_STRING", ";", "pos", "=", "firstStart", ";", "}", "}", "pos", "=", "rewriteNodeList", "(", "node", ",", "superInterfaceProperty", ",", "pos", ",", "keyword", ",", "\",", "\"", ")", ";", "}", "int", "startIndent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "1", ";", "int", "startPos", "=", "getPosAfterLeftBrace", "(", "pos", ")", ";", "rewriteParagraphList", "(", "node", ",", "TypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "startPos", ",", "startIndent", ",", "-", "1", ",", "2", ")", ";", "return", "false", ";", "}", "private", "void", "rewriteReturnType", "(", "MethodDeclaration", "node", ",", "boolean", "isConstructor", ",", "boolean", "isConstructorChange", ")", "{", "ChildPropertyDescriptor", "property", "=", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "?", "MethodDeclaration", ".", "RETURN_TYPE_PROPERTY", ":", "MethodDeclaration", ".", "RETURN_TYPE2_PROPERTY", ";", "ASTNode", "originalReturnType", "=", "(", "ASTNode", ")", "getOriginalValue", "(", "node", ",", "property", ")", ";", "boolean", "returnTypeExists", "=", "originalReturnType", "!=", "null", "&&", "originalReturnType", ".", "getStartPosition", "(", ")", "!=", "-", "1", ";", "if", "(", "!", "isConstructorChange", "&&", "returnTypeExists", ")", "{", "rewriteRequiredNode", "(", "node", ",", "property", ")", ";", "ensureSpaceAfterReplace", "(", "node", ",", "property", ")", ";", "return", ";", "}", "ASTNode", "newReturnType", "=", "(", "ASTNode", ")", "getNewValue", "(", "node", ",", "property", ")", ";", "if", "(", "isConstructorChange", "||", "!", "returnTypeExists", "&&", "newReturnType", "!=", "originalReturnType", ")", "{", "ASTNode", "originalMethodName", "=", "(", "ASTNode", ")", "getOriginalValue", "(", "node", ",", "MethodDeclaration", ".", "NAME_PROPERTY", ")", ";", "int", "nextStart", "=", "originalMethodName", ".", "getStartPosition", "(", ")", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "node", ",", "property", ")", ";", "if", "(", "isConstructor", "||", "!", "returnTypeExists", ")", "{", "doTextInsert", "(", "nextStart", ",", "newReturnType", ",", "getIndent", "(", "nextStart", ")", ",", "true", ",", "editGroup", ")", ";", "doTextInsert", "(", "nextStart", ",", "\"", "\"", ",", "editGroup", ")", ";", "}", "else", "{", "int", "offset", "=", "getExtendedOffset", "(", "originalReturnType", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "nextStart", "-", "offset", ",", "originalReturnType", ",", "editGroup", ")", ";", "}", "}", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "MethodDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "MethodDeclaration", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "pos", "=", "rewriteModifiers2", "(", "node", ",", "MethodDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "pos", "=", "rewriteOptionalTypeParameters", "(", "node", ",", "MethodDeclaration", ".", "TYPE_PARAMETERS_PROPERTY", ",", "pos", ",", "\"", "\"", ",", "true", ",", "pos", "!=", "node", ".", "getStartPosition", "(", ")", ")", ";", "}", "boolean", "isConstructorChange", "=", "isChanged", "(", "node", ",", "MethodDeclaration", ".", "CONSTRUCTOR_PROPERTY", ")", ";", "boolean", "isConstructor", "=", "(", "(", "Boolean", ")", "getOriginalValue", "(", "node", ",", "MethodDeclaration", ".", "CONSTRUCTOR_PROPERTY", ")", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "!", "isConstructor", "||", "isConstructorChange", ")", "{", "rewriteReturnType", "(", "node", ",", "isConstructor", ",", "isConstructorChange", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "MethodDeclaration", ".", "NAME_PROPERTY", ")", ";", "try", "{", "if", "(", "isChanged", "(", "node", ",", "MethodDeclaration", ".", "PARAMETERS_PROPERTY", ")", ")", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "MethodDeclaration", ".", "PARAMETERS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "MethodDeclaration", ".", "PARAMETERS_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRPAREN", ",", "pos", ")", ";", "int", "extraDims", "=", "rewriteExtraDimensions", "(", "node", ",", "MethodDeclaration", ".", "EXTRA_DIMENSIONS_PROPERTY", ",", "pos", ")", ";", "boolean", "hasExceptionChanges", "=", "isChanged", "(", "node", ",", "MethodDeclaration", ".", "THROWN_EXCEPTIONS_PROPERTY", ")", ";", "int", "bodyChangeKind", "=", "getChangeKind", "(", "node", ",", "MethodDeclaration", ".", "BODY_PROPERTY", ")", ";", "if", "(", "(", "extraDims", ">", "0", ")", "&&", "(", "hasExceptionChanges", "||", "bodyChangeKind", "==", "RewriteEvent", ".", "INSERTED", "||", "bodyChangeKind", "==", "RewriteEvent", ".", "REMOVED", ")", ")", "{", "int", "dim", "=", "(", "(", "Integer", ")", "getOriginalValue", "(", "node", ",", "MethodDeclaration", ".", "EXTRA_DIMENSIONS_PROPERTY", ")", ")", ".", "intValue", "(", ")", ";", "while", "(", "dim", ">", "0", ")", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRBRACKET", ",", "pos", ")", ";", "dim", "--", ";", "}", "}", "pos", "=", "rewriteNodeList", "(", "node", ",", "MethodDeclaration", ".", "THROWN_EXCEPTIONS_PROPERTY", ",", "pos", ",", "\"", "throws", "\"", ",", "\",", "\"", ")", ";", "rewriteMethodBody", "(", "node", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Block", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "startPos", ";", "if", "(", "isCollapsed", "(", "node", ")", ")", "{", "startPos", "=", "node", ".", "getStartPosition", "(", ")", ";", "}", "else", "{", "startPos", "=", "getPosAfterLeftBrace", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "}", "int", "startIndent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "1", ";", "rewriteParagraphList", "(", "node", ",", "Block", ".", "STATEMENTS_PROPERTY", ",", "startPos", ",", "startIndent", ",", "0", ",", "1", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ReturnStatement", "node", ")", "{", "try", "{", "this", ".", "beforeRequiredSpaceIndex", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamereturn", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "ensureSpaceBeforeReplace", "(", "node", ")", ";", "rewriteNode", "(", "node", ",", "ReturnStatement", ".", "EXPRESSION_PROPERTY", ",", "this", ".", "beforeRequiredSpaceIndex", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "startPos", "=", "getPosAfterLeftBrace", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "int", "startIndent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "1", ";", "rewriteParagraphList", "(", "node", ",", "AnonymousClassDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "startPos", ",", "startIndent", ",", "-", "1", ",", "2", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayAccess", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "ArrayAccess", ".", "ARRAY_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "ArrayAccess", ".", "INDEX_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayCreation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "ArrayType", "arrayType", "=", "(", "ArrayType", ")", "getOriginalValue", "(", "node", ",", "ArrayCreation", ".", "TYPE_PROPERTY", ")", ";", "int", "nOldBrackets", "=", "getDimensions", "(", "arrayType", ")", ";", "int", "nNewBrackets", "=", "nOldBrackets", ";", "TextEditGroup", "editGroup", "=", "null", ";", "RewriteEvent", "typeEvent", "=", "getEvent", "(", "node", ",", "ArrayCreation", ".", "TYPE_PROPERTY", ")", ";", "if", "(", "typeEvent", "!=", "null", "&&", "typeEvent", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ArrayType", "replacingType", "=", "(", "ArrayType", ")", "typeEvent", ".", "getNewValue", "(", ")", ";", "editGroup", "=", "getEditGroup", "(", "typeEvent", ")", ";", "Type", "newType", "=", "replacingType", ".", "getElementType", "(", ")", ";", "Type", "oldType", "=", "getElementType", "(", "arrayType", ")", ";", "if", "(", "!", "newType", ".", "equals", "(", "oldType", ")", ")", "{", "SourceRange", "range", "=", "getExtendedRange", "(", "oldType", ")", ";", "int", "offset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemove", "(", "offset", ",", "length", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "newType", ",", "0", ",", "false", ",", "editGroup", ")", ";", "}", "nNewBrackets", "=", "replacingType", ".", "getDimensions", "(", ")", ";", "}", "voidVisit", "(", "arrayType", ")", ";", "try", "{", "int", "offset", "=", "getScanner", "(", ")", ".", "getTokenStartOffset", "(", "TerminalTokens", ".", "TokenNameLBRACKET", ",", "arrayType", ".", "getStartPosition", "(", ")", ")", ";", "RewriteEvent", "dimEvent", "=", "getEvent", "(", "node", ",", "ArrayCreation", ".", "DIMENSIONS_PROPERTY", ")", ";", "boolean", "hasDimensionChanges", "=", "(", "dimEvent", "!=", "null", "&&", "dimEvent", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", ";", "if", "(", "hasDimensionChanges", ")", "{", "RewriteEvent", "[", "]", "events", "=", "dimEvent", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "length", ";", "i", "++", ")", "{", "RewriteEvent", "event", "=", "events", "[", "i", "]", ";", "int", "changeKind", "=", "event", ".", "getChangeKind", "(", ")", ";", "if", "(", "changeKind", "==", "RewriteEvent", ".", "INSERTED", ")", "{", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "doTextInsert", "(", "offset", ",", "\"[\"", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "0", ",", "false", ",", "editGroup", ")", ";", "doTextInsert", "(", "offset", ",", "\"]\"", ",", "editGroup", ")", ";", "nNewBrackets", "--", ";", "}", "else", "{", "ASTNode", "elem", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "int", "elemEnd", "=", "elem", ".", "getStartPosition", "(", ")", "+", "elem", ".", "getLength", "(", ")", ";", "int", "endPos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRBRACKET", ",", "elemEnd", ")", ";", "if", "(", "changeKind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "doTextRemoveAndVisit", "(", "offset", ",", "endPos", "-", "offset", ",", "elem", ",", "editGroup", ")", ";", "}", "else", "if", "(", "changeKind", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "editGroup", "=", "getEditGroup", "(", "event", ")", ";", "SourceRange", "range", "=", "getExtendedRange", "(", "elem", ")", ";", "int", "elemOffset", "=", "range", ".", "getStartPosition", "(", ")", ";", "int", "elemLength", "=", "range", ".", "getLength", "(", ")", ";", "doTextRemoveAndVisit", "(", "elemOffset", ",", "elemLength", ",", "elem", ",", "editGroup", ")", ";", "doTextInsert", "(", "elemOffset", ",", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ",", "0", ",", "false", ",", "editGroup", ")", ";", "nNewBrackets", "--", ";", "}", "else", "{", "voidVisit", "(", "elem", ")", ";", "nNewBrackets", "--", ";", "}", "offset", "=", "endPos", ";", "nOldBrackets", "--", ";", "}", "}", "}", "else", "{", "offset", "=", "doVisit", "(", "node", ",", "ArrayCreation", ".", "DIMENSIONS_PROPERTY", ",", "offset", ")", ";", "}", "if", "(", "nOldBrackets", "!=", "nNewBrackets", ")", "{", "if", "(", "!", "hasDimensionChanges", ")", "{", "offset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRBRACKET", ",", "offset", ")", ";", "}", "rewriteExtraDimensions", "(", "nOldBrackets", ",", "nNewBrackets", ",", "offset", ",", "editGroup", ")", ";", "}", "int", "kind", "=", "getChangeKind", "(", "node", ",", "ArrayCreation", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "kind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "offset", "=", "getScanner", "(", ")", ".", "getPreviousTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLBRACE", ",", "offset", ")", ";", "}", "else", "{", "offset", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "}", "rewriteNode", "(", "node", ",", "ArrayCreation", ".", "INITIALIZER_PROPERTY", ",", "offset", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "private", "Type", "getElementType", "(", "ArrayType", "parent", ")", "{", "Type", "t", "=", "(", "Type", ")", "getOriginalValue", "(", "parent", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "while", "(", "t", ".", "isArrayType", "(", ")", ")", "{", "t", "=", "(", "Type", ")", "getOriginalValue", "(", "t", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "}", "return", "t", ";", "}", "private", "int", "getDimensions", "(", "ArrayType", "parent", ")", "{", "Type", "t", "=", "(", "Type", ")", "getOriginalValue", "(", "parent", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "int", "dimensions", "=", "1", ";", "while", "(", "t", ".", "isArrayType", "(", ")", ")", "{", "dimensions", "++", ";", "t", "=", "(", "Type", ")", "getOriginalValue", "(", "t", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "}", "return", "dimensions", ";", "}", "public", "boolean", "visit", "(", "ArrayInitializer", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "startPos", "=", "getPosAfterLeftBrace", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "rewriteNodeList", "(", "node", ",", "ArrayInitializer", ".", "EXPRESSIONS_PROPERTY", ",", "startPos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "ArrayType", ".", "COMPONENT_TYPE_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AssertStatement", "node", ")", "{", "try", "{", "this", ".", "beforeRequiredSpaceIndex", "=", "getScanner", "(", ")", ".", "getNextEndOffset", "(", "node", ".", "getStartPosition", "(", ")", ",", "true", ")", ";", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "ensureSpaceBeforeReplace", "(", "node", ")", ";", "int", "offset", "=", "rewriteRequiredNode", "(", "node", ",", "AssertStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "rewriteNode", "(", "node", ",", "AssertStatement", ".", "MESSAGE_PROPERTY", ",", "offset", ",", "ASTRewriteFormatter", ".", "ASSERT_COMMENT", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Assignment", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "Assignment", ".", "LEFT_HAND_SIDE_PROPERTY", ")", ";", "rewriteOperation", "(", "node", ",", "Assignment", ".", "OPERATOR_PROPERTY", ",", "pos", ")", ";", "rewriteRequiredNode", "(", "node", ",", "Assignment", ".", "RIGHT_HAND_SIDE_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BooleanLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "Boolean", "newLiteral", "=", "(", "Boolean", ")", "getNewValue", "(", "node", ",", "BooleanLiteral", ".", "BOOLEAN_VALUE_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "BooleanLiteral", ".", "BOOLEAN_VALUE_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newLiteral", ".", "toString", "(", ")", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BreakStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "try", "{", "int", "offset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamebreak", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "rewriteNode", "(", "node", ",", "BreakStatement", ".", "LABEL_PROPERTY", ",", "offset", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CastExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "CastExpression", ".", "TYPE_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "CastExpression", ".", "EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CatchClause", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "CatchClause", ".", "EXCEPTION_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "CatchClause", ".", "BODY_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CharacterLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "escapedSeq", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "CharacterLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "CharacterLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "escapedSeq", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ClassInstanceCreation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteOptionalQualifier", "(", "node", ",", "ClassInstanceCreation", ".", "EXPRESSION_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "ClassInstanceCreation", ".", "NAME_PROPERTY", ")", ";", "}", "else", "{", "if", "(", "isChanged", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamenew", ",", "pos", ")", ";", "rewriteOptionalTypeParameters", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "pos", ",", "\"", "\"", ",", "true", ",", "true", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_ARGUMENTS_PROPERTY", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "ClassInstanceCreation", ".", "TYPE_PROPERTY", ")", ";", "}", "if", "(", "isChanged", "(", "node", ",", "ClassInstanceCreation", ".", "ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "int", "startpos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "ClassInstanceCreation", ".", "ARGUMENTS_PROPERTY", ",", "startpos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "ClassInstanceCreation", ".", "ARGUMENTS_PROPERTY", ")", ";", "}", "int", "kind", "=", "getChangeKind", "(", "node", ",", "ClassInstanceCreation", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "if", "(", "kind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getPreviousTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLBRACE", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "}", "rewriteNode", "(", "node", ",", "ClassInstanceCreation", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ",", "pos", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConditionalExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "ConditionalExpression", ".", "EXPRESSION_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "ConditionalExpression", ".", "THEN_EXPRESSION_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "ConditionalExpression", ".", "ELSE_EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConstructorInvocation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "pos", "=", "rewriteOptionalTypeParameters", "(", "node", ",", "ConstructorInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "false", ",", "false", ")", ";", "}", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "ConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ContinueStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "try", "{", "int", "offset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamecontinue", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "rewriteNode", "(", "node", ",", "ContinueStatement", ".", "LABEL_PROPERTY", ",", "offset", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "DoStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "try", "{", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "DoStatement", ".", "BODY_PROPERTY", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamedo", ",", "pos", ")", ";", "ASTNode", "body", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "int", "bodyEnd", "=", "body", ".", "getStartPosition", "(", ")", "+", "body", ".", "getLength", "(", ")", ";", "int", "endPos", "=", "getScanner", "(", ")", ".", "getTokenStartOffset", "(", "TerminalTokens", ".", "TokenNamewhile", ",", "bodyEnd", ")", ";", "rewriteBodyNode", "(", "node", ",", "DoStatement", ".", "BODY_PROPERTY", ",", "startOffset", ",", "endPos", ",", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ",", "this", ".", "formatter", ".", "DO_BLOCK", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ",", "DoStatement", ".", "BODY_PROPERTY", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "DoStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EmptyStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "changeNotSupported", "(", "node", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ExpressionStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "ExpressionStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldAccess", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "FieldAccess", ".", "EXPRESSION_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "FieldAccess", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "FieldDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "FieldDeclaration", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "FieldDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "FieldDeclaration", ".", "TYPE_PROPERTY", ")", ";", "ensureSpaceAfterReplace", "(", "node", ",", "FieldDeclaration", ".", "TYPE_PROPERTY", ")", ";", "rewriteNodeList", "(", "node", ",", "FieldDeclaration", ".", "FRAGMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ForStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "try", "{", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "isChanged", "(", "node", ",", "ForStatement", ".", "INITIALIZERS_PROPERTY", ")", ")", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "ForStatement", ".", "INITIALIZERS_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "ForStatement", ".", "INITIALIZERS_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameSEMICOLON", ",", "pos", ")", ";", "pos", "=", "rewriteNode", "(", "node", ",", "ForStatement", ".", "EXPRESSION_PROPERTY", ",", "pos", ",", "ASTRewriteFormatter", ".", "NONE", ")", ";", "if", "(", "isChanged", "(", "node", ",", "ForStatement", ".", "UPDATERS_PROPERTY", ")", ")", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameSEMICOLON", ",", "pos", ")", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "ForStatement", ".", "UPDATERS_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "ForStatement", ".", "UPDATERS_PROPERTY", ",", "pos", ")", ";", "}", "RewriteEvent", "bodyEvent", "=", "getEvent", "(", "node", ",", "ForStatement", ".", "BODY_PROPERTY", ")", ";", "if", "(", "bodyEvent", "!=", "null", "&&", "bodyEvent", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRPAREN", ",", "pos", ")", ";", "rewriteBodyNode", "(", "node", ",", "ForStatement", ".", "BODY_PROPERTY", ",", "startOffset", ",", "-", "1", ",", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ",", "this", ".", "formatter", ".", "FOR_BLOCK", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ",", "ForStatement", ".", "BODY_PROPERTY", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "IfStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "IfStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "RewriteEvent", "thenEvent", "=", "getEvent", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ")", ";", "int", "elseChange", "=", "getChangeKind", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ")", ";", "if", "(", "thenEvent", "!=", "null", "&&", "thenEvent", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "try", "{", "int", "tok", "=", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "true", ")", ";", "pos", "=", "(", "tok", "==", "TerminalTokens", ".", "TokenNameRPAREN", ")", "?", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ":", "getScanner", "(", ")", ".", "getCurrentStartOffset", "(", ")", ";", "int", "indent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "int", "endPos", "=", "-", "1", ";", "Object", "elseStatement", "=", "getOriginalValue", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ")", ";", "if", "(", "elseStatement", "!=", "null", ")", "{", "ASTNode", "thenStatement", "=", "(", "ASTNode", ")", "thenEvent", ".", "getOriginalValue", "(", ")", ";", "endPos", "=", "getScanner", "(", ")", ".", "getTokenStartOffset", "(", "TerminalTokens", ".", "TokenNameelse", ",", "thenStatement", ".", "getStartPosition", "(", ")", "+", "thenStatement", ".", "getLength", "(", ")", ")", ";", "}", "if", "(", "elseStatement", "==", "null", "||", "elseChange", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "pos", "=", "rewriteBodyNode", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ",", "pos", ",", "endPos", ",", "indent", ",", "this", ".", "formatter", ".", "IF_BLOCK_NO_ELSE", ")", ";", "}", "else", "{", "pos", "=", "rewriteBodyNode", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ",", "pos", ",", "endPos", ",", "indent", ",", "this", ".", "formatter", ".", "IF_BLOCK_WITH_ELSE", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ",", "pos", ")", ";", "}", "if", "(", "elseChange", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "int", "indent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "Object", "newThen", "=", "getNewValue", "(", "node", ",", "IfStatement", ".", "THEN_STATEMENT_PROPERTY", ")", ";", "if", "(", "newThen", "instanceof", "Block", ")", "{", "rewriteBodyNode", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ",", "pos", ",", "-", "1", ",", "indent", ",", "this", ".", "formatter", ".", "ELSE_AFTER_BLOCK", ")", ";", "}", "else", "{", "rewriteBodyNode", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ",", "pos", ",", "-", "1", ",", "indent", ",", "this", ".", "formatter", ".", "ELSE_AFTER_STATEMENT", ")", ";", "}", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "IfStatement", ".", "ELSE_STATEMENT_PROPERTY", ",", "pos", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ImportDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "ImportDeclaration", ".", "STATIC_PROPERTY", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "try", "{", "int", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameimport", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "boolean", "wasStatic", "=", "(", "(", "Boolean", ")", "event", ".", "getOriginalValue", "(", ")", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "wasStatic", ")", "{", "int", "endPos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamestatic", ",", "pos", ")", ";", "doTextRemove", "(", "pos", ",", "endPos", "-", "pos", ",", "getEditGroup", "(", "event", ")", ")", ";", "}", "else", "{", "doTextInsert", "(", "pos", ",", "\"", "static\"", ",", "getEditGroup", "(", "event", ")", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "ImportDeclaration", ".", "NAME_PROPERTY", ")", ";", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "ImportDeclaration", ".", "ON_DEMAND_PROPERTY", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "boolean", "isOnDemand", "=", "(", "(", "Boolean", ")", "event", ".", "getOriginalValue", "(", ")", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "!", "isOnDemand", ")", "{", "doTextInsert", "(", "pos", ",", "\".*\"", ",", "getEditGroup", "(", "event", ")", ")", ";", "}", "else", "{", "try", "{", "int", "endPos", "=", "getScanner", "(", ")", ".", "getTokenStartOffset", "(", "TerminalTokens", ".", "TokenNameSEMICOLON", ",", "pos", ")", ";", "doTextRemove", "(", "pos", ",", "endPos", "-", "pos", ",", "getEditGroup", "(", "event", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InfixExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "InfixExpression", ".", "LEFT_OPERAND_PROPERTY", ")", ";", "boolean", "needsNewOperation", "=", "isChanged", "(", "node", ",", "InfixExpression", ".", "OPERATOR_PROPERTY", ")", ";", "String", "operation", "=", "getNewValue", "(", "node", ",", "InfixExpression", ".", "OPERATOR_PROPERTY", ")", ".", "toString", "(", ")", ";", "if", "(", "needsNewOperation", ")", "{", "replaceOperation", "(", "pos", ",", "operation", ",", "getEditGroup", "(", "node", ",", "InfixExpression", ".", "OPERATOR_PROPERTY", ")", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "InfixExpression", ".", "RIGHT_OPERAND_PROPERTY", ")", ";", "RewriteEvent", "event", "=", "getEvent", "(", "node", ",", "InfixExpression", ".", "EXTENDED_OPERANDS_PROPERTY", ")", ";", "String", "prefixString", "=", "'", "'", "+", "operation", "+", "'", "'", ";", "if", "(", "needsNewOperation", ")", "{", "int", "startPos", "=", "pos", ";", "TextEditGroup", "editGroup", "=", "getEditGroup", "(", "node", ",", "InfixExpression", ".", "OPERATOR_PROPERTY", ")", ";", "if", "(", "event", "!=", "null", "&&", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "RewriteEvent", "[", "]", "extendedOperands", "=", "event", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extendedOperands", ".", "length", ";", "i", "++", ")", "{", "RewriteEvent", "curr", "=", "extendedOperands", "[", "i", "]", ";", "ASTNode", "elem", "=", "(", "ASTNode", ")", "curr", ".", "getOriginalValue", "(", ")", ";", "if", "(", "elem", "!=", "null", ")", "{", "if", "(", "curr", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "REPLACED", ")", "{", "replaceOperation", "(", "startPos", ",", "operation", ",", "editGroup", ")", ";", "}", "startPos", "=", "elem", ".", "getStartPosition", "(", ")", "+", "elem", ".", "getLength", "(", ")", ";", "}", "}", "}", "else", "{", "List", "extendedOperands", "=", "(", "List", ")", "getOriginalValue", "(", "node", ",", "InfixExpression", ".", "EXTENDED_OPERANDS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extendedOperands", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ASTNode", "elem", "=", "(", "ASTNode", ")", "extendedOperands", ".", "get", "(", "i", ")", ";", "replaceOperation", "(", "startPos", ",", "operation", ",", "editGroup", ")", ";", "startPos", "=", "elem", ".", "getStartPosition", "(", ")", "+", "elem", ".", "getLength", "(", ")", ";", "}", "}", "}", "rewriteNodeList", "(", "node", ",", "InfixExpression", ".", "EXTENDED_OPERANDS_PROPERTY", ",", "pos", ",", "prefixString", ",", "prefixString", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Initializer", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "Initializer", ".", "JAVADOC_PROPERTY", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "Initializer", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "Initializer", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "Initializer", ".", "BODY_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InstanceofExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "InstanceofExpression", ".", "LEFT_OPERAND_PROPERTY", ")", ";", "ensureSpaceAfterReplace", "(", "node", ",", "InstanceofExpression", ".", "LEFT_OPERAND_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "InstanceofExpression", ".", "RIGHT_OPERAND_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "void", "ensureSpaceAfterReplace", "(", "ASTNode", "node", ",", "ChildPropertyDescriptor", "desc", ")", "{", "if", "(", "getChangeKind", "(", "node", ",", "desc", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "int", "leftOperandEnd", "=", "getExtendedEnd", "(", "(", "ASTNode", ")", "getOriginalValue", "(", "node", ",", "desc", ")", ")", ";", "try", "{", "int", "offset", "=", "getScanner", "(", ")", ".", "getNextStartOffset", "(", "leftOperandEnd", ",", "true", ")", ";", "if", "(", "offset", "==", "leftOperandEnd", ")", "{", "doTextInsert", "(", "offset", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "getEditGroup", "(", "node", ",", "desc", ")", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "public", "void", "ensureSpaceBeforeReplace", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "beforeRequiredSpaceIndex", "==", "-", "1", ")", "return", ";", "List", "events", "=", "this", ".", "eventStore", ".", "getChangedPropertieEvents", "(", "node", ")", ";", "for", "(", "Iterator", "iterator", "=", "events", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "RewriteEvent", "event", "=", "(", "RewriteEvent", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", "&&", "event", ".", "getOriginalValue", "(", ")", "instanceof", "ASTNode", ")", "{", "if", "(", "this", ".", "beforeRequiredSpaceIndex", "==", "getExtendedOffset", "(", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ")", ")", "{", "doTextInsert", "(", "this", ".", "beforeRequiredSpaceIndex", ",", "String", ".", "valueOf", "(", "'", "'", ")", ",", "getEditGroup", "(", "event", ")", ")", ";", "this", ".", "beforeRequiredSpaceIndex", "=", "-", "1", ";", "return", ";", "}", "}", "}", "if", "(", "this", ".", "beforeRequiredSpaceIndex", "<", "getExtendedOffset", "(", "node", ")", ")", "{", "this", ".", "beforeRequiredSpaceIndex", "=", "-", "1", ";", "}", "}", "public", "boolean", "visit", "(", "Javadoc", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "startPos", "=", "node", ".", "getStartPosition", "(", ")", "+", "3", ";", "String", "separator", "=", "getLineDelimiter", "(", ")", "+", "getIndentAtOffset", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "\"", "*", "\"", ";", "rewriteNodeList", "(", "node", ",", "Javadoc", ".", "TAGS_PROPERTY", ",", "startPos", ",", "separator", ",", "separator", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "LabeledStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "LabeledStatement", ".", "LABEL_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "LabeledStatement", ".", "BODY_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodInvocation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteOptionalQualifier", "(", "node", ",", "MethodInvocation", ".", "EXPRESSION_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "pos", "=", "rewriteOptionalTypeParameters", "(", "node", ",", "MethodInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "false", ",", "false", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "MethodInvocation", ".", "NAME_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "MethodInvocation", ".", "ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "MethodInvocation", ".", "ARGUMENTS_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "MethodInvocation", ".", "ARGUMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NullLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "changeNotSupported", "(", "node", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NumberLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "newLiteral", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "NumberLiteral", ".", "TOKEN_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "NumberLiteral", ".", "TOKEN_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newLiteral", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PackageDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "PackageDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "rewriteModifiers2", "(", "node", ",", "PackageDeclaration", ".", "ANNOTATIONS_PROPERTY", ",", "pos", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "PackageDeclaration", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParenthesizedExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "ParenthesizedExpression", ".", "EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PostfixExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "PostfixExpression", ".", "OPERAND_PROPERTY", ")", ";", "rewriteOperation", "(", "node", ",", "PostfixExpression", ".", "OPERATOR_PROPERTY", ",", "pos", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrefixExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteOperation", "(", "node", ",", "PrefixExpression", ".", "OPERATOR_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "rewriteRequiredNode", "(", "node", ",", "PrefixExpression", ".", "OPERAND_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrimitiveType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "PrimitiveType", ".", "Code", "newCode", "=", "(", "PrimitiveType", ".", "Code", ")", "getNewValue", "(", "node", ",", "PrimitiveType", ".", "PRIMITIVE_TYPE_CODE_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "PrimitiveType", ".", "PRIMITIVE_TYPE_CODE_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newCode", ".", "toString", "(", ")", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedName", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "QualifiedName", ".", "QUALIFIER_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "QualifiedName", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleName", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "newString", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "SimpleName", ".", "IDENTIFIER_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "SimpleName", ".", "IDENTIFIER_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newString", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "SimpleType", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleVariableDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "SingleVariableDeclaration", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "SingleVariableDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "SingleVariableDeclaration", ".", "TYPE_PROPERTY", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "isChanged", "(", "node", ",", "SingleVariableDeclaration", ".", "VARARGS_PROPERTY", ")", ")", "{", "if", "(", "getNewValue", "(", "node", ",", "SingleVariableDeclaration", ".", "VARARGS_PROPERTY", ")", ".", "equals", "(", "Boolean", ".", "TRUE", ")", ")", "{", "doTextInsert", "(", "pos", ",", "\"...\"", ",", "getEditGroup", "(", "node", ",", "SingleVariableDeclaration", ".", "VARARGS_PROPERTY", ")", ")", ";", "}", "else", "{", "try", "{", "int", "ellipsisEnd", "=", "getScanner", "(", ")", ".", "getNextEndOffset", "(", "pos", ",", "true", ")", ";", "doTextRemove", "(", "pos", ",", "ellipsisEnd", "-", "pos", ",", "getEditGroup", "(", "node", ",", "SingleVariableDeclaration", ".", "VARARGS_PROPERTY", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "if", "(", "!", "node", ".", "isVarargs", "(", ")", ")", "{", "ensureSpaceAfterReplace", "(", "node", ",", "SingleVariableDeclaration", ".", "TYPE_PROPERTY", ")", ";", "}", "}", "else", "{", "ensureSpaceAfterReplace", "(", "node", ",", "SingleVariableDeclaration", ".", "TYPE_PROPERTY", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "SingleVariableDeclaration", ".", "NAME_PROPERTY", ")", ";", "int", "extraDims", "=", "rewriteExtraDimensions", "(", "node", ",", "SingleVariableDeclaration", ".", "EXTRA_DIMENSIONS_PROPERTY", ",", "pos", ")", ";", "if", "(", "extraDims", ">", "0", ")", "{", "int", "kind", "=", "getChangeKind", "(", "node", ",", "SingleVariableDeclaration", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "kind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getPreviousTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameEQUAL", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "}", "}", "rewriteNode", "(", "node", ",", "SingleVariableDeclaration", ".", "INITIALIZER_PROPERTY", ",", "pos", ",", "this", ".", "formatter", ".", "VAR_INITIALIZER", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "StringLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "escapedSeq", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "StringLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "StringLiteral", ".", "ESCAPED_VALUE_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "escapedSeq", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperConstructorInvocation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteOptionalQualifier", "(", "node", ",", "SuperConstructorInvocation", ".", "EXPRESSION_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "pos", "=", "rewriteOptionalTypeParameters", "(", "node", ",", "SuperConstructorInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "false", ",", "false", ")", ";", "}", "if", "(", "isChanged", "(", "node", ",", "SuperConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "SuperConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "SuperConstructorInvocation", ".", "ARGUMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperFieldAccess", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteOptionalQualifier", "(", "node", ",", "SuperFieldAccess", ".", "QUALIFIER_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "rewriteRequiredNode", "(", "node", ",", "SuperFieldAccess", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperMethodInvocation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteOptionalQualifier", "(", "node", ",", "SuperMethodInvocation", ".", "QUALIFIER_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "isChanged", "(", "node", ",", "SuperMethodInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameDOT", ",", "pos", ")", ";", "rewriteOptionalTypeParameters", "(", "node", ",", "SuperMethodInvocation", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "false", ",", "false", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "SuperMethodInvocation", ".", "NAME_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "SuperMethodInvocation", ".", "ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "SuperMethodInvocation", ".", "ARGUMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "SuperMethodInvocation", ".", "ARGUMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SwitchCase", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "SwitchCase", ".", "EXPRESSION_PROPERTY", ")", ";", "return", "false", ";", "}", "class", "SwitchListRewriter", "extends", "ParagraphListRewriter", "{", "private", "boolean", "indentSwitchStatementsCompareToCases", ";", "public", "SwitchListRewriter", "(", "int", "initialIndent", ")", "{", "super", "(", "initialIndent", ",", "0", ")", ";", "this", ".", "indentSwitchStatementsCompareToCases", "=", "DefaultCodeFormatterConstants", ".", "TRUE", ".", "equals", "(", "ASTRewriteAnalyzer", ".", "this", ".", "options", ".", "get", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES", ")", ")", ";", "}", "protected", "int", "getNodeIndent", "(", "int", "nodeIndex", ")", "{", "int", "indent", "=", "getInitialIndent", "(", ")", ";", "if", "(", "this", ".", "indentSwitchStatementsCompareToCases", ")", "{", "RewriteEvent", "event", "=", "this", ".", "list", "[", "nodeIndex", "]", ";", "int", "changeKind", "=", "event", ".", "getChangeKind", "(", ")", ";", "ASTNode", "node", ";", "if", "(", "changeKind", "==", "RewriteEvent", ".", "INSERTED", "||", "changeKind", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "node", "=", "(", "ASTNode", ")", "event", ".", "getNewValue", "(", ")", ";", "}", "else", "{", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "}", "if", "(", "node", ".", "getNodeType", "(", ")", "!=", "ASTNode", ".", "SWITCH_CASE", ")", "{", "indent", "++", ";", "}", "}", "return", "indent", ";", "}", "protected", "String", "getSeparatorString", "(", "int", "nodeIndex", ")", "{", "int", "total", "=", "this", ".", "list", ".", "length", ";", "int", "nextNodeIndex", "=", "nodeIndex", "+", "1", ";", "while", "(", "nextNodeIndex", "<", "total", "&&", "this", ".", "list", "[", "nextNodeIndex", "]", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "nextNodeIndex", "++", ";", "}", "if", "(", "nextNodeIndex", "==", "total", ")", "{", "return", "super", ".", "getSeparatorString", "(", "nodeIndex", ")", ";", "}", "return", "getSeparatorString", "(", "nodeIndex", ",", "nextNodeIndex", ")", ";", "}", "protected", "void", "updateIndent", "(", "int", "prevMark", ",", "int", "originalOffset", ",", "int", "nodeIndex", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "prevMark", "!=", "RewriteEvent", ".", "UNCHANGED", "&&", "prevMark", "!=", "RewriteEvent", ".", "REPLACED", ")", "return", ";", "int", "previousNonRemovedNodeIndex", "=", "nodeIndex", "-", "1", ";", "while", "(", "previousNonRemovedNodeIndex", ">=", "0", "&&", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "previousNonRemovedNodeIndex", "--", ";", "}", "if", "(", "previousNonRemovedNodeIndex", ">", "-", "1", ")", "{", "LineInformation", "lineInformation", "=", "getLineInformation", "(", ")", ";", "RewriteEvent", "prevEvent", "=", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ";", "int", "prevKind", "=", "prevEvent", ".", "getChangeKind", "(", ")", ";", "if", "(", "prevKind", "==", "RewriteEvent", ".", "UNCHANGED", "||", "prevKind", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "ASTNode", "prevNode", "=", "(", "ASTNode", ")", "this", ".", "list", "[", "previousNonRemovedNodeIndex", "]", ".", "getOriginalValue", "(", ")", ";", "int", "prevEndPosition", "=", "prevNode", ".", "getStartPosition", "(", ")", "+", "prevNode", ".", "getLength", "(", ")", ";", "int", "prevLine", "=", "lineInformation", ".", "getLineOfOffset", "(", "prevEndPosition", ")", ";", "int", "line", "=", "lineInformation", ".", "getLineOfOffset", "(", "originalOffset", ")", ";", "if", "(", "prevLine", "==", "line", ")", "{", "return", ";", "}", "}", "}", "int", "total", "=", "this", ".", "list", ".", "length", ";", "while", "(", "nodeIndex", "<", "total", "&&", "this", ".", "list", "[", "nodeIndex", "]", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "nodeIndex", "++", ";", "}", "int", "originalIndent", "=", "getIndent", "(", "originalOffset", ")", ";", "int", "newIndent", "=", "getNodeIndent", "(", "nodeIndex", ")", ";", "if", "(", "originalIndent", "!=", "newIndent", ")", "{", "int", "line", "=", "getLineInformation", "(", ")", ".", "getLineOfOffset", "(", "originalOffset", ")", ";", "if", "(", "line", ">=", "0", ")", "{", "int", "lineStart", "=", "getLineInformation", "(", ")", ".", "getLineOffset", "(", "line", ")", ";", "doTextRemove", "(", "lineStart", ",", "originalOffset", "-", "lineStart", ",", "editGroup", ")", ";", "doTextInsert", "(", "lineStart", ",", "createIndentString", "(", "newIndent", ")", ",", "editGroup", ")", ";", "}", "}", "}", "}", "public", "boolean", "visit", "(", "SwitchStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "SwitchStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "ChildListPropertyDescriptor", "property", "=", "SwitchStatement", ".", "STATEMENTS_PROPERTY", ";", "if", "(", "getChangeKind", "(", "node", ",", "property", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLBRACE", ",", "pos", ")", ";", "int", "insertIndent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "DefaultCodeFormatterConstants", ".", "TRUE", ".", "equals", "(", "this", ".", "options", ".", "get", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH", ")", ")", ")", "{", "insertIndent", "++", ";", "}", "ParagraphListRewriter", "listRewriter", "=", "new", "SwitchListRewriter", "(", "insertIndent", ")", ";", "StringBuffer", "leadString", "=", "new", "StringBuffer", "(", ")", ";", "leadString", ".", "append", "(", "getLineDelimiter", "(", ")", ")", ";", "leadString", ".", "append", "(", "createIndentString", "(", "insertIndent", ")", ")", ";", "listRewriter", ".", "rewriteList", "(", "node", ",", "property", ",", "pos", ",", "leadString", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "SwitchStatement", ".", "STATEMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SynchronizedStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "SynchronizedStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "SynchronizedStatement", ".", "BODY_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThisExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteOptionalQualifier", "(", "node", ",", "ThisExpression", ".", "QUALIFIER_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThrowStatement", "node", ")", "{", "try", "{", "this", ".", "beforeRequiredSpaceIndex", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNamethrow", ",", "node", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "ensureSpaceBeforeReplace", "(", "node", ")", ";", "rewriteRequiredNode", "(", "node", ",", "ThrowStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TryStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "AST", ".", "JLS4", ")", "{", "if", "(", "isChanged", "(", "node", ",", "TryStatement", ".", "RESOURCES_PROPERTY", ")", ")", "{", "int", "indent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "String", "prefix", "=", "this", ".", "formatter", ".", "TRY_RESOURCES", ".", "getPrefix", "(", "indent", ")", ";", "String", "newParen", "=", "this", ".", "formatter", ".", "TRY_RESOURCES_PAREN", ".", "getPrefix", "(", "indent", ")", "+", "\"(\"", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "TryStatement", ".", "RESOURCES_PROPERTY", ",", "getPosAfterTry", "(", "pos", ")", ",", "newParen", ",", "\")\"", ",", "\";\"", "+", "prefix", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "TryStatement", ".", "RESOURCES_PROPERTY", ",", "pos", ")", ";", "}", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "TryStatement", ".", "BODY_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "TryStatement", ".", "CATCH_CLAUSES_PROPERTY", ")", ")", "{", "int", "indent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ";", "String", "prefix", "=", "this", ".", "formatter", ".", "CATCH_BLOCK", ".", "getPrefix", "(", "indent", ")", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "TryStatement", ".", "CATCH_CLAUSES_PROPERTY", ",", "pos", ",", "prefix", ",", "prefix", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "TryStatement", ".", "CATCH_CLAUSES_PROPERTY", ",", "pos", ")", ";", "}", "rewriteNode", "(", "node", ",", "TryStatement", ".", "FINALLY_PROPERTY", ",", "pos", ",", "this", ".", "formatter", ".", "FINALLY_BLOCK", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclarationStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteRequiredNode", "(", "node", ",", "TypeDeclarationStatement", ".", "TYPE_DECLARATION_PROPERTY", ")", ";", "}", "else", "{", "rewriteRequiredNode", "(", "node", ",", "TypeDeclarationStatement", ".", "DECLARATION_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeLiteral", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "TypeLiteral", ".", "TYPE_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "UnionType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "isChanged", "(", "node", ",", "UnionType", ".", "TYPES_PROPERTY", ")", ")", "{", "pos", "=", "rewriteNodeList", "(", "node", ",", "UnionType", ".", "TYPES_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\"", "|", "\"", ")", ";", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "UnionType", ".", "TYPES_PROPERTY", ",", "pos", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationExpression", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "VariableDeclarationExpression", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "VariableDeclarationExpression", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "VariableDeclarationExpression", ".", "TYPE_PROPERTY", ")", ";", "rewriteNodeList", "(", "node", ",", "VariableDeclarationExpression", ".", "FRAGMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationFragment", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "VariableDeclarationFragment", ".", "NAME_PROPERTY", ")", ";", "int", "extraDims", "=", "rewriteExtraDimensions", "(", "node", ",", "VariableDeclarationFragment", ".", "EXTRA_DIMENSIONS_PROPERTY", ",", "pos", ")", ";", "if", "(", "extraDims", ">", "0", ")", "{", "int", "kind", "=", "getChangeKind", "(", "node", ",", "VariableDeclarationFragment", ".", "INITIALIZER_PROPERTY", ")", ";", "if", "(", "kind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getPreviousTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameEQUAL", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "}", "}", "rewriteNode", "(", "node", ",", "VariableDeclarationFragment", ".", "INITIALIZER_PROPERTY", ",", "pos", ",", "this", ".", "formatter", ".", "VAR_INITIALIZER", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "node", ".", "getStartPosition", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2_INTERNAL", ")", "{", "rewriteModifiers", "(", "node", ",", "VariableDeclarationStatement", ".", "MODIFIERS_PROPERTY", ",", "pos", ")", ";", "}", "else", "{", "rewriteModifiers2", "(", "node", ",", "VariableDeclarationStatement", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "}", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "VariableDeclarationStatement", ".", "TYPE_PROPERTY", ")", ";", "rewriteNodeList", "(", "node", ",", "VariableDeclarationStatement", ".", "FRAGMENTS_PROPERTY", ",", "pos", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WhileStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "WhileStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "try", "{", "if", "(", "isChanged", "(", "node", ",", "WhileStatement", ".", "BODY_PROPERTY", ")", ")", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRPAREN", ",", "pos", ")", ";", "rewriteBodyNode", "(", "node", ",", "WhileStatement", ".", "BODY_PROPERTY", ",", "startOffset", ",", "-", "1", ",", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ",", "this", ".", "formatter", ".", "WHILE_BLOCK", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ",", "WhileStatement", ".", "BODY_PROPERTY", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberRef", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteNode", "(", "node", ",", "MemberRef", ".", "QUALIFIER_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ",", "ASTRewriteFormatter", ".", "NONE", ")", ";", "rewriteRequiredNode", "(", "node", ",", "MemberRef", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRef", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteNode", "(", "node", ",", "MethodRef", ".", "QUALIFIER_PROPERTY", ",", "node", ".", "getStartPosition", "(", ")", ",", "ASTRewriteFormatter", ".", "NONE", ")", ";", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "MethodRef", ".", "NAME_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "MethodRef", ".", "PARAMETERS_PROPERTY", ")", ")", "{", "try", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "MethodRef", ".", "PARAMETERS_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "MethodRef", ".", "PARAMETERS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRefParameter", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "MethodRefParameter", ".", "TYPE_PROPERTY", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3_INTERNAL", ")", "{", "if", "(", "isChanged", "(", "node", ",", "MethodRefParameter", ".", "VARARGS_PROPERTY", ")", ")", "{", "if", "(", "getNewValue", "(", "node", ",", "MethodRefParameter", ".", "VARARGS_PROPERTY", ")", ".", "equals", "(", "Boolean", ".", "TRUE", ")", ")", "{", "doTextInsert", "(", "pos", ",", "\"...\"", ",", "getEditGroup", "(", "node", ",", "MethodRefParameter", ".", "VARARGS_PROPERTY", ")", ")", ";", "}", "else", "{", "try", "{", "int", "ellipsisEnd", "=", "getScanner", "(", ")", ".", "getNextEndOffset", "(", "pos", ",", "true", ")", ";", "doTextRemove", "(", "pos", ",", "ellipsisEnd", "-", "pos", ",", "getEditGroup", "(", "node", ",", "MethodRefParameter", ".", "VARARGS_PROPERTY", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "}", "}", "rewriteNode", "(", "node", ",", "MethodRefParameter", ".", "NAME_PROPERTY", ",", "pos", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TagElement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "changeKind", "=", "getChangeKind", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ";", "switch", "(", "changeKind", ")", "{", "case", "RewriteEvent", ".", "INSERTED", ":", "{", "String", "newTagName", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ";", "doTextInsert", "(", "node", ".", "getStartPosition", "(", ")", ",", "newTagName", ",", "getEditGroup", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ")", ";", "break", ";", "}", "case", "RewriteEvent", ".", "REMOVED", ":", "{", "doTextRemove", "(", "node", ".", "getStartPosition", "(", ")", ",", "findTagNameEnd", "(", "node", ")", "-", "node", ".", "getStartPosition", "(", ")", ",", "getEditGroup", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ")", ";", "break", ";", "}", "case", "RewriteEvent", ".", "REPLACED", ":", "{", "String", "newTagName", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "findTagNameEnd", "(", "node", ")", "-", "node", ".", "getStartPosition", "(", ")", ",", "newTagName", ",", "getEditGroup", "(", "node", ",", "TagElement", ".", "TAG_NAME_PROPERTY", ")", ")", ";", "break", ";", "}", "}", "if", "(", "isChanged", "(", "node", ",", "TagElement", ".", "FRAGMENTS_PROPERTY", ")", ")", "{", "int", "endOffset", "=", "findTagNameEnd", "(", "node", ")", ";", "rewriteNodeList", "(", "node", ",", "TagElement", ".", "FRAGMENTS_PROPERTY", ",", "endOffset", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ",", "TagElement", ".", "FRAGMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "private", "int", "findTagNameEnd", "(", "TagElement", "tagNode", ")", "{", "if", "(", "tagNode", ".", "getTagName", "(", ")", "!=", "null", ")", "{", "char", "[", "]", "cont", "=", "getContent", "(", ")", ";", "int", "len", "=", "cont", ".", "length", ";", "int", "i", "=", "tagNode", ".", "getStartPosition", "(", ")", ";", "while", "(", "i", "<", "len", "&&", "!", "IndentManipulation", ".", "isIndentChar", "(", "cont", "[", "i", "]", ")", ")", "{", "i", "++", ";", "}", "return", "i", ";", "}", "return", "tagNode", ".", "getStartPosition", "(", ")", ";", "}", "public", "boolean", "visit", "(", "TextElement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "newText", "=", "(", "String", ")", "getNewValue", "(", "node", ",", "TextElement", ".", "TEXT_PROPERTY", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "TextElement", ".", "TEXT_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newText", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "AnnotationTypeDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "rewriteModifiers2", "(", "node", ",", "AnnotationTypeDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "AnnotationTypeDeclaration", ".", "NAME_PROPERTY", ")", ";", "int", "startIndent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "1", ";", "int", "startPos", "=", "getPosAfterLeftBrace", "(", "pos", ")", ";", "rewriteParagraphList", "(", "node", ",", "AnnotationTypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "startPos", ",", "startIndent", ",", "-", "1", ",", "2", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeMemberDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "rewriteModifiers2", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "rewriteRequiredNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "TYPE_PROPERTY", ")", ";", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "NAME_PROPERTY", ")", ";", "try", "{", "int", "changeKind", "=", "getChangeKind", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "DEFAULT_PROPERTY", ")", ";", "if", "(", "changeKind", "==", "RewriteEvent", ".", "INSERTED", "||", "changeKind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "pos", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRPAREN", ",", "pos", ")", ";", "}", "rewriteNode", "(", "node", ",", "AnnotationTypeMemberDeclaration", ".", "DEFAULT_PROPERTY", ",", "pos", ",", "this", ".", "formatter", ".", "ANNOT_MEMBER_DEFAULT", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnhancedForStatement", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "EnhancedForStatement", ".", "PARAMETER_PROPERTY", ")", ";", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "EnhancedForStatement", ".", "EXPRESSION_PROPERTY", ")", ";", "RewriteEvent", "bodyEvent", "=", "getEvent", "(", "node", ",", "EnhancedForStatement", ".", "BODY_PROPERTY", ")", ";", "if", "(", "bodyEvent", "!=", "null", "&&", "bodyEvent", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "REPLACED", ")", "{", "int", "startOffset", ";", "try", "{", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameRPAREN", ",", "pos", ")", ";", "rewriteBodyNode", "(", "node", ",", "EnhancedForStatement", ".", "BODY_PROPERTY", ",", "startOffset", ",", "-", "1", ",", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ",", "this", ".", "formatter", ".", "FOR_BLOCK", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "EnhancedForStatement", ".", "BODY_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumConstantDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "EnumConstantDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "rewriteModifiers2", "(", "node", ",", "EnumConstantDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "EnumConstantDeclaration", ".", "NAME_PROPERTY", ")", ";", "RewriteEvent", "argsEvent", "=", "getEvent", "(", "node", ",", "EnumConstantDeclaration", ".", "ARGUMENTS_PROPERTY", ")", ";", "if", "(", "argsEvent", "!=", "null", "&&", "argsEvent", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "RewriteEvent", "[", "]", "children", "=", "argsEvent", ".", "getChildren", "(", ")", ";", "try", "{", "int", "nextTok", "=", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "true", ")", ";", "boolean", "hasParents", "=", "(", "nextTok", "==", "TerminalTokens", ".", "TokenNameLPAREN", ")", ";", "boolean", "isAllRemoved", "=", "hasParents", "&&", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "REMOVED", ")", ";", "String", "prefix", "=", "Util", ".", "EMPTY_STRING", ";", "if", "(", "!", "hasParents", ")", "{", "prefix", "=", "\"(\"", ";", "}", "else", "if", "(", "!", "isAllRemoved", ")", "{", "pos", "=", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "}", "pos", "=", "rewriteNodeList", "(", "node", ",", "EnumConstantDeclaration", ".", "ARGUMENTS_PROPERTY", ",", "pos", ",", "prefix", ",", "\",", "\"", ")", ";", "if", "(", "!", "hasParents", ")", "{", "doTextInsert", "(", "pos", ",", "\")\"", ",", "getEditGroup", "(", "children", "[", "children", ".", "length", "-", "1", "]", ")", ")", ";", "}", "else", "if", "(", "isAllRemoved", ")", "{", "int", "afterClosing", "=", "getScanner", "(", ")", ".", "getNextEndOffset", "(", "pos", ",", "true", ")", ";", "doTextRemove", "(", "pos", ",", "afterClosing", "-", "pos", ",", "getEditGroup", "(", "children", "[", "children", ".", "length", "-", "1", "]", ")", ")", ";", "pos", "=", "afterClosing", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "doVisit", "(", "node", ",", "EnumConstantDeclaration", ".", "ARGUMENTS_PROPERTY", ",", "pos", ")", ";", "}", "if", "(", "isChanged", "(", "node", ",", "EnumConstantDeclaration", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ")", "{", "int", "kind", "=", "getChangeKind", "(", "node", ",", "EnumConstantDeclaration", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "if", "(", "kind", "==", "RewriteEvent", ".", "REMOVED", ")", "{", "try", "{", "pos", "=", "getScanner", "(", ")", ".", "getPreviousTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLBRACE", ",", "pos", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "pos", "=", "node", ".", "getStartPosition", "(", ")", "+", "node", ".", "getLength", "(", ")", ";", "}", "rewriteNode", "(", "node", ",", "EnumConstantDeclaration", ".", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ",", "pos", ",", "ASTRewriteFormatter", ".", "SPACE", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteJavadoc", "(", "node", ",", "EnumDeclaration", ".", "JAVADOC_PROPERTY", ")", ";", "rewriteModifiers2", "(", "node", ",", "EnumDeclaration", ".", "MODIFIERS2_PROPERTY", ",", "pos", ")", ";", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "EnumDeclaration", ".", "NAME_PROPERTY", ")", ";", "pos", "=", "rewriteNodeList", "(", "node", ",", "EnumDeclaration", ".", "SUPER_INTERFACE_TYPES_PROPERTY", ",", "pos", ",", "\"", "implements", "\"", ",", "\",", "\"", ")", ";", "pos", "=", "getPosAfterLeftBrace", "(", "pos", ")", ";", "String", "leadString", "=", "Util", ".", "EMPTY_STRING", ";", "RewriteEvent", "constEvent", "=", "getEvent", "(", "node", ",", "EnumDeclaration", ".", "ENUM_CONSTANTS_PROPERTY", ")", ";", "if", "(", "constEvent", "!=", "null", "&&", "constEvent", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "RewriteEvent", "[", "]", "events", "=", "constEvent", ".", "getChildren", "(", ")", ";", "if", "(", "isAllOfKind", "(", "events", ",", "RewriteEvent", ".", "INSERTED", ")", ")", "{", "leadString", "=", "this", ".", "formatter", ".", "FIRST_ENUM_CONST", ".", "getPrefix", "(", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", ")", ";", "}", "}", "pos", "=", "rewriteNodeList", "(", "node", ",", "EnumDeclaration", ".", "ENUM_CONSTANTS_PROPERTY", ",", "pos", ",", "leadString", ",", "\",", "\"", ")", ";", "RewriteEvent", "bodyEvent", "=", "getEvent", "(", "node", ",", "EnumDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ")", ";", "int", "indent", "=", "0", ";", "if", "(", "bodyEvent", "!=", "null", "&&", "bodyEvent", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "boolean", "hasConstants", "=", "!", "(", "(", "List", ")", "getNewValue", "(", "node", ",", "EnumDeclaration", ".", "ENUM_CONSTANTS_PROPERTY", ")", ")", ".", "isEmpty", "(", ")", ";", "RewriteEvent", "[", "]", "children", "=", "bodyEvent", ".", "getChildren", "(", ")", ";", "try", "{", "if", "(", "hasConstants", ")", "{", "indent", "=", "getIndent", "(", "pos", ")", ";", "}", "else", "{", "indent", "=", "getIndent", "(", "node", ".", "getStartPosition", "(", ")", ")", "+", "1", ";", "}", "int", "token", "=", "getScanner", "(", ")", ".", "readNext", "(", "pos", ",", "true", ")", ";", "boolean", "hasSemicolon", "=", "token", "==", "TerminalTokens", ".", "TokenNameSEMICOLON", ";", "if", "(", "!", "hasSemicolon", "&&", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "INSERTED", ")", ")", "{", "if", "(", "!", "hasConstants", ")", "{", "String", "str", "=", "this", ".", "formatter", ".", "FIRST_ENUM_CONST", ".", "getPrefix", "(", "indent", "-", "1", ")", ";", "doTextInsert", "(", "pos", ",", "str", ",", "getEditGroup", "(", "children", "[", "0", "]", ")", ")", ";", "}", "if", "(", "token", "==", "TerminalTokens", ".", "TokenNameCOMMA", ")", "{", "int", "endPos", "=", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "int", "nextToken", "=", "getScanner", "(", ")", ".", "readNext", "(", "endPos", ",", "true", ")", ";", "if", "(", "nextToken", "!=", "TerminalTokens", ".", "TokenNameSEMICOLON", ")", "{", "doTextInsert", "(", "endPos", ",", "\";\"", ",", "getEditGroup", "(", "children", "[", "0", "]", ")", ")", ";", "}", "else", "{", "endPos", "=", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "if", "(", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "REMOVED", ")", ")", "{", "doTextRemove", "(", "pos", ",", "endPos", "-", "pos", ",", "getEditGroup", "(", "children", "[", "0", "]", ")", ")", ";", "}", "}", "pos", "=", "endPos", ";", "}", "else", "{", "doTextInsert", "(", "pos", ",", "\";\"", ",", "getEditGroup", "(", "children", "[", "0", "]", ")", ")", ";", "}", "}", "else", "if", "(", "hasSemicolon", ")", "{", "int", "endPos", "=", "getScanner", "(", ")", ".", "getCurrentEndOffset", "(", ")", ";", "if", "(", "isAllOfKind", "(", "children", ",", "RewriteEvent", ".", "REMOVED", ")", ")", "{", "doTextRemove", "(", "pos", ",", "endPos", "-", "pos", ",", "getEditGroup", "(", "children", "[", "0", "]", ")", ")", ";", "}", "pos", "=", "endPos", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "rewriteParagraphList", "(", "node", ",", "EnumDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ",", "pos", ",", "indent", ",", "-", "1", ",", "2", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MarkerAnnotation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "MarkerAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberValuePair", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "MemberValuePair", ".", "NAME_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "MemberValuePair", ".", "VALUE_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Modifier", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "String", "newText", "=", "getNewValue", "(", "node", ",", "Modifier", ".", "KEYWORD_PROPERTY", ")", ".", "toString", "(", ")", ";", "TextEditGroup", "group", "=", "getEditGroup", "(", "node", ",", "Modifier", ".", "KEYWORD_PROPERTY", ")", ";", "doTextReplace", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ",", "newText", ",", "group", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NormalAnnotation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "NormalAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "NormalAnnotation", ".", "VALUES_PROPERTY", ")", ")", "{", "try", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLPAREN", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "NormalAnnotation", ".", "VALUES_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "NormalAnnotation", ".", "VALUES_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParameterizedType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "ParameterizedType", ".", "TYPE_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "ParameterizedType", ".", "TYPE_ARGUMENTS_PROPERTY", ")", ")", "{", "try", "{", "int", "startOffset", "=", "getScanner", "(", ")", ".", "getTokenEndOffset", "(", "TerminalTokens", ".", "TokenNameLESS", ",", "pos", ")", ";", "rewriteNodeList", "(", "node", ",", "ParameterizedType", ".", "TYPE_ARGUMENTS_PROPERTY", ",", "startOffset", ",", "Util", ".", "EMPTY_STRING", ",", "\",", "\"", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "}", "else", "{", "voidVisit", "(", "node", ",", "ParameterizedType", ".", "TYPE_ARGUMENTS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "QualifiedType", ".", "QUALIFIER_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "QualifiedType", ".", "NAME_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleMemberAnnotation", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "rewriteRequiredNode", "(", "node", ",", "SingleMemberAnnotation", ".", "TYPE_NAME_PROPERTY", ")", ";", "rewriteRequiredNode", "(", "node", ",", "SingleMemberAnnotation", ".", "VALUE_PROPERTY", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeParameter", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "int", "pos", "=", "rewriteRequiredNode", "(", "node", ",", "TypeParameter", ".", "NAME_PROPERTY", ")", ";", "if", "(", "isChanged", "(", "node", ",", "TypeParameter", ".", "TYPE_BOUNDS_PROPERTY", ")", ")", "{", "rewriteNodeList", "(", "node", ",", "TypeParameter", ".", "TYPE_BOUNDS_PROPERTY", ",", "pos", ",", "\"", "extends", "\"", ",", "\"", "&", "\"", ")", ";", "}", "else", "{", "voidVisit", "(", "node", ",", "TypeParameter", ".", "TYPE_BOUNDS_PROPERTY", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WildcardType", "node", ")", "{", "if", "(", "!", "hasChildrenChanges", "(", "node", ")", ")", "{", "return", "doVisitUnchangedChildren", "(", "node", ")", ";", "}", "try", "{", "int", "pos", "=", "getScanner", "(", ")", ".", "getNextEndOffset", "(", "node", ".", "getStartPosition", "(", ")", ",", "true", ")", ";", "Prefix", "prefix", ";", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "getNewValue", "(", "node", ",", "WildcardType", ".", "UPPER_BOUND_PROPERTY", ")", ")", ")", "{", "prefix", "=", "this", ".", "formatter", ".", "WILDCARD_EXTENDS", ";", "}", "else", "{", "prefix", "=", "this", ".", "formatter", ".", "WILDCARD_SUPER", ";", "}", "int", "boundKindChange", "=", "getChangeKind", "(", "node", ",", "WildcardType", ".", "UPPER_BOUND_PROPERTY", ")", ";", "if", "(", "boundKindChange", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "int", "boundTypeChange", "=", "getChangeKind", "(", "node", ",", "WildcardType", ".", "BOUND_PROPERTY", ")", ";", "if", "(", "boundTypeChange", "!=", "RewriteEvent", ".", "INSERTED", "&&", "boundTypeChange", "!=", "RewriteEvent", ".", "REMOVED", ")", "{", "ASTNode", "type", "=", "(", "ASTNode", ")", "getOriginalValue", "(", "node", ",", "WildcardType", ".", "BOUND_PROPERTY", ")", ";", "String", "str", "=", "prefix", ".", "getPrefix", "(", "0", ")", ";", "doTextReplace", "(", "pos", ",", "type", ".", "getStartPosition", "(", ")", "-", "pos", ",", "str", ",", "getEditGroup", "(", "node", ",", "WildcardType", ".", "BOUND_PROPERTY", ")", ")", ";", "}", "}", "rewriteNode", "(", "node", ",", "WildcardType", ".", "BOUND_PROPERTY", ",", "pos", ",", "prefix", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "handleException", "(", "e", ")", ";", "}", "return", "false", ";", "}", "final", "void", "handleException", "(", "Throwable", "e", ")", "{", "IllegalArgumentException", "runtimeException", "=", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "runtimeException", ".", "initCause", "(", "e", ")", ";", "throw", "runtimeException", ";", "}", "}", "</s>" ]
2,323
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadLocationException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "public", "abstract", "class", "LineInformation", "{", "public", "static", "LineInformation", "create", "(", "final", "IDocument", "doc", ")", "{", "return", "new", "LineInformation", "(", ")", "{", "public", "int", "getLineOfOffset", "(", "int", "offset", ")", "{", "try", "{", "return", "doc", ".", "getLineOfOffset", "(", "offset", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "return", "-", "1", ";", "}", "}", "public", "int", "getLineOffset", "(", "int", "line", ")", "{", "try", "{", "return", "doc", ".", "getLineOffset", "(", "line", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "return", "-", "1", ";", "}", "}", "}", ";", "}", "public", "static", "LineInformation", "create", "(", "final", "CompilationUnit", "astRoot", ")", "{", "return", "new", "LineInformation", "(", ")", "{", "public", "int", "getLineOfOffset", "(", "int", "offset", ")", "{", "return", "astRoot", ".", "getLineNumber", "(", "offset", ")", "-", "1", ";", "}", "public", "int", "getLineOffset", "(", "int", "line", ")", "{", "return", "astRoot", ".", "getPosition", "(", "line", "+", "1", ",", "0", ")", ";", "}", "}", ";", "}", "public", "abstract", "int", "getLineOfOffset", "(", "int", "offset", ")", ";", "public", "abstract", "int", "getLineOffset", "(", "int", "line", ")", ";", "}", "</s>" ]
2,324
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Block", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "StructuralPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "TargetSourceRangeComputer", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "public", "final", "class", "RewriteEventStore", "{", "public", "static", "final", "class", "PropertyLocation", "{", "private", "final", "ASTNode", "parent", ";", "private", "final", "StructuralPropertyDescriptor", "property", ";", "public", "PropertyLocation", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "property", "=", "property", ";", "}", "public", "ASTNode", "getParent", "(", ")", "{", "return", "this", ".", "parent", ";", "}", "public", "StructuralPropertyDescriptor", "getProperty", "(", ")", "{", "return", "this", ".", "property", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "!=", "null", "&&", "obj", ".", "getClass", "(", ")", ".", "equals", "(", "getClass", "(", ")", ")", ")", "{", "PropertyLocation", "other", "=", "(", "PropertyLocation", ")", "obj", ";", "return", "other", ".", "getParent", "(", ")", ".", "equals", "(", "getParent", "(", ")", ")", "&&", "other", ".", "getProperty", "(", ")", ".", "equals", "(", "getProperty", "(", ")", ")", ";", "}", "return", "false", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "getParent", "(", ")", ".", "hashCode", "(", ")", "+", "getProperty", "(", ")", ".", "hashCode", "(", ")", ";", "}", "}", "public", "static", "interface", "INodePropertyMapper", "{", "Object", "getOriginalValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", ";", "}", "private", "static", "class", "EventHolder", "{", "public", "final", "ASTNode", "parent", ";", "public", "final", "StructuralPropertyDescriptor", "childProperty", ";", "public", "final", "RewriteEvent", "event", ";", "public", "EventHolder", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "RewriteEvent", "change", ")", "{", "this", ".", "parent", "=", "parent", ";", "this", ".", "childProperty", "=", "childProperty", ";", "this", ".", "event", "=", "change", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "this", ".", "parent", ")", ".", "append", "(", "\"", "-", "\"", ")", ";", "buf", ".", "append", "(", "this", ".", "childProperty", ".", "getId", "(", ")", ")", ".", "append", "(", "\":", "\"", ")", ";", "buf", ".", "append", "(", "this", ".", "event", ")", ".", "append", "(", "'\\n'", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "public", "static", "class", "CopySourceInfo", "implements", "Comparable", "{", "public", "final", "PropertyLocation", "location", ";", "private", "final", "ASTNode", "node", ";", "public", "final", "boolean", "isMove", ";", "public", "CopySourceInfo", "(", "PropertyLocation", "location", ",", "ASTNode", "node", ",", "boolean", "isMove", ")", "{", "this", ".", "location", "=", "location", ";", "this", ".", "node", "=", "node", ";", "this", ".", "isMove", "=", "isMove", ";", "}", "public", "ASTNode", "getNode", "(", ")", "{", "return", "this", ".", "node", ";", "}", "public", "int", "compareTo", "(", "Object", "o2", ")", "{", "CopySourceInfo", "r2", "=", "(", "CopySourceInfo", ")", "o2", ";", "int", "startDiff", "=", "getNode", "(", ")", ".", "getStartPosition", "(", ")", "-", "r2", ".", "getNode", "(", ")", ".", "getStartPosition", "(", ")", ";", "if", "(", "startDiff", "!=", "0", ")", "{", "return", "startDiff", ";", "}", "if", "(", "r2", ".", "isMove", "!=", "this", ".", "isMove", ")", "{", "return", "this", ".", "isMove", "?", "-", "1", ":", "1", ";", "}", "return", "0", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "this", ".", "isMove", ")", "{", "buf", ".", "append", "(", "\"\"", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "\"\"", ")", ";", "}", "buf", ".", "append", "(", "this", ".", "node", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "private", "static", "class", "NodeRangeInfo", "implements", "Comparable", "{", "private", "final", "ASTNode", "first", ";", "private", "final", "ASTNode", "last", ";", "public", "final", "CopySourceInfo", "copyInfo", ";", "public", "final", "ASTNode", "replacingNode", ";", "public", "final", "TextEditGroup", "editGroup", ";", "public", "NodeRangeInfo", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "ASTNode", "first", ",", "ASTNode", "last", ",", "CopySourceInfo", "copyInfo", ",", "ASTNode", "replacingNode", ",", "TextEditGroup", "editGroup", ")", "{", "this", ".", "first", "=", "first", ";", "this", ".", "last", "=", "last", ";", "this", ".", "copyInfo", "=", "copyInfo", ";", "this", ".", "replacingNode", "=", "replacingNode", ";", "this", ".", "editGroup", "=", "editGroup", ";", "}", "public", "ASTNode", "getStartNode", "(", ")", "{", "return", "this", ".", "first", ";", "}", "public", "ASTNode", "getEndNode", "(", ")", "{", "return", "this", ".", "last", ";", "}", "public", "boolean", "isMove", "(", ")", "{", "return", "this", ".", "copyInfo", ".", "isMove", ";", "}", "public", "Block", "getInternalPlaceholder", "(", ")", "{", "return", "(", "Block", ")", "this", ".", "copyInfo", ".", "getNode", "(", ")", ";", "}", "public", "int", "compareTo", "(", "Object", "o2", ")", "{", "NodeRangeInfo", "r2", "=", "(", "NodeRangeInfo", ")", "o2", ";", "int", "startDiff", "=", "getStartNode", "(", ")", ".", "getStartPosition", "(", ")", "-", "r2", ".", "getStartNode", "(", ")", ".", "getStartPosition", "(", ")", ";", "if", "(", "startDiff", "!=", "0", ")", "{", "return", "startDiff", ";", "}", "int", "endDiff", "=", "getEndNode", "(", ")", ".", "getStartPosition", "(", ")", "-", "r2", ".", "getEndNode", "(", ")", ".", "getStartPosition", "(", ")", ";", "if", "(", "endDiff", "!=", "0", ")", "{", "return", "-", "endDiff", ";", "}", "if", "(", "r2", ".", "isMove", "(", ")", "!=", "isMove", "(", ")", ")", "{", "return", "isMove", "(", ")", "?", "-", "1", ":", "1", ";", "}", "return", "0", ";", "}", "public", "void", "updatePlaceholderSourceRanges", "(", "TargetSourceRangeComputer", "sourceRangeComputer", ")", "{", "TargetSourceRangeComputer", ".", "SourceRange", "startRange", "=", "sourceRangeComputer", ".", "computeSourceRange", "(", "getStartNode", "(", ")", ")", ";", "TargetSourceRangeComputer", ".", "SourceRange", "endRange", "=", "sourceRangeComputer", ".", "computeSourceRange", "(", "getEndNode", "(", ")", ")", ";", "int", "startPos", "=", "startRange", ".", "getStartPosition", "(", ")", ";", "int", "endPos", "=", "endRange", ".", "getStartPosition", "(", ")", "+", "endRange", ".", "getLength", "(", ")", ";", "Block", "internalPlaceholder", "=", "getInternalPlaceholder", "(", ")", ";", "internalPlaceholder", ".", "setSourceRange", "(", "startPos", ",", "endPos", "-", "startPos", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "this", ".", "first", "!=", "this", ".", "last", ")", "{", "buf", ".", "append", "(", "\"range", "\"", ")", ";", "}", "if", "(", "isMove", "(", ")", ")", "{", "buf", ".", "append", "(", "\"\"", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "\"\"", ")", ";", "}", "buf", ".", "append", "(", "this", ".", "first", ")", ";", "buf", ".", "append", "(", "\"", "-", "\"", ")", ";", "buf", ".", "append", "(", "this", ".", "last", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "private", "class", "ParentIterator", "implements", "Iterator", "{", "private", "Iterator", "eventIter", ";", "private", "Iterator", "sourceNodeIter", ";", "private", "Iterator", "rangeNodeIter", ";", "private", "Iterator", "trackedNodeIter", ";", "public", "ParentIterator", "(", ")", "{", "this", ".", "eventIter", "=", "RewriteEventStore", ".", "this", ".", "eventLookup", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "if", "(", "RewriteEventStore", ".", "this", ".", "nodeCopySources", "!=", "null", ")", "{", "this", ".", "sourceNodeIter", "=", "RewriteEventStore", ".", "this", ".", "nodeCopySources", ".", "iterator", "(", ")", ";", "}", "else", "{", "this", ".", "sourceNodeIter", "=", "Collections", ".", "EMPTY_LIST", ".", "iterator", "(", ")", ";", "}", "if", "(", "RewriteEventStore", ".", "this", ".", "nodeRangeInfos", "!=", "null", ")", "{", "this", ".", "rangeNodeIter", "=", "RewriteEventStore", ".", "this", ".", "nodeRangeInfos", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "}", "else", "{", "this", ".", "rangeNodeIter", "=", "Collections", ".", "EMPTY_LIST", ".", "iterator", "(", ")", ";", "}", "if", "(", "RewriteEventStore", ".", "this", ".", "trackedNodes", "!=", "null", ")", "{", "this", ".", "trackedNodeIter", "=", "RewriteEventStore", ".", "this", ".", "trackedNodes", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "}", "else", "{", "this", ".", "trackedNodeIter", "=", "Collections", ".", "EMPTY_LIST", ".", "iterator", "(", ")", ";", "}", "}", "public", "boolean", "hasNext", "(", ")", "{", "return", "this", ".", "eventIter", ".", "hasNext", "(", ")", "||", "this", ".", "sourceNodeIter", ".", "hasNext", "(", ")", "||", "this", ".", "rangeNodeIter", ".", "hasNext", "(", ")", "||", "this", ".", "trackedNodeIter", ".", "hasNext", "(", ")", ";", "}", "public", "Object", "next", "(", ")", "{", "if", "(", "this", ".", "eventIter", ".", "hasNext", "(", ")", ")", "{", "return", "this", ".", "eventIter", ".", "next", "(", ")", ";", "}", "if", "(", "this", ".", "sourceNodeIter", ".", "hasNext", "(", ")", ")", "{", "return", "(", "(", "CopySourceInfo", ")", "this", ".", "sourceNodeIter", ".", "next", "(", ")", ")", ".", "getNode", "(", ")", ";", "}", "if", "(", "this", ".", "rangeNodeIter", ".", "hasNext", "(", ")", ")", "{", "return", "(", "(", "PropertyLocation", ")", "this", ".", "rangeNodeIter", ".", "next", "(", ")", ")", ".", "getParent", "(", ")", ";", "}", "return", "this", ".", "trackedNodeIter", ".", "next", "(", ")", ";", "}", "public", "void", "remove", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "}", "public", "final", "static", "int", "NEW", "=", "1", ";", "public", "final", "static", "int", "ORIGINAL", "=", "2", ";", "public", "final", "static", "int", "BOTH", "=", "NEW", "|", "ORIGINAL", ";", "final", "Map", "eventLookup", ";", "private", "EventHolder", "lastEvent", ";", "private", "Map", "editGroups", ";", "List", "nodeCopySources", ";", "Map", "nodeRangeInfos", ";", "Map", "trackedNodes", ";", "private", "Set", "insertBoundToPrevious", ";", "private", "INodePropertyMapper", "nodePropertyMapper", ";", "private", "static", "final", "String", "INTERNAL_PLACEHOLDER_PROPERTY", "=", "\"\"", ";", "public", "RewriteEventStore", "(", ")", "{", "this", ".", "eventLookup", "=", "new", "HashMap", "(", ")", ";", "this", ".", "lastEvent", "=", "null", ";", "this", ".", "editGroups", "=", "null", ";", "this", ".", "trackedNodes", "=", "null", ";", "this", ".", "insertBoundToPrevious", "=", "null", ";", "this", ".", "nodePropertyMapper", "=", "null", ";", "this", ".", "nodeCopySources", "=", "null", ";", "this", ".", "nodeRangeInfos", "=", "null", ";", "}", "public", "void", "setNodePropertyMapper", "(", "INodePropertyMapper", "nodePropertyMapper", ")", "{", "this", ".", "nodePropertyMapper", "=", "nodePropertyMapper", ";", "}", "public", "void", "clear", "(", ")", "{", "this", ".", "eventLookup", ".", "clear", "(", ")", ";", "this", ".", "lastEvent", "=", "null", ";", "this", ".", "trackedNodes", "=", "null", ";", "this", ".", "editGroups", "=", "null", ";", "this", ".", "insertBoundToPrevious", "=", "null", ";", "this", ".", "nodeCopySources", "=", "null", ";", "}", "public", "void", "addEvent", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "RewriteEvent", "event", ")", "{", "validateHasChildProperty", "(", "parent", ",", "childProperty", ")", ";", "if", "(", "event", ".", "isListRewrite", "(", ")", ")", "{", "validateIsListProperty", "(", "childProperty", ")", ";", "}", "EventHolder", "holder", "=", "new", "EventHolder", "(", "parent", ",", "childProperty", ",", "event", ")", ";", "List", "entriesList", "=", "(", "List", ")", "this", ".", "eventLookup", ".", "get", "(", "parent", ")", ";", "if", "(", "entriesList", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entriesList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "EventHolder", "curr", "=", "(", "EventHolder", ")", "entriesList", ".", "get", "(", "i", ")", ";", "if", "(", "curr", ".", "childProperty", "==", "childProperty", ")", "{", "entriesList", ".", "set", "(", "i", ",", "holder", ")", ";", "this", ".", "lastEvent", "=", "null", ";", "return", ";", "}", "}", "}", "else", "{", "entriesList", "=", "new", "ArrayList", "(", "3", ")", ";", "this", ".", "eventLookup", ".", "put", "(", "parent", ",", "entriesList", ")", ";", "}", "entriesList", ".", "add", "(", "holder", ")", ";", "}", "public", "RewriteEvent", "getEvent", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "validateHasChildProperty", "(", "parent", ",", "property", ")", ";", "if", "(", "this", ".", "lastEvent", "!=", "null", "&&", "this", ".", "lastEvent", ".", "parent", "==", "parent", "&&", "this", ".", "lastEvent", ".", "childProperty", "==", "property", ")", "{", "return", "this", ".", "lastEvent", ".", "event", ";", "}", "List", "entriesList", "=", "(", "List", ")", "this", ".", "eventLookup", ".", "get", "(", "parent", ")", ";", "if", "(", "entriesList", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entriesList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "EventHolder", "holder", "=", "(", "EventHolder", ")", "entriesList", ".", "get", "(", "i", ")", ";", "if", "(", "holder", ".", "childProperty", "==", "property", ")", "{", "this", ".", "lastEvent", "=", "holder", ";", "return", "holder", ".", "event", ";", "}", "}", "}", "return", "null", ";", "}", "public", "NodeRewriteEvent", "getNodeEvent", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "boolean", "forceCreation", ")", "{", "validateIsNodeProperty", "(", "childProperty", ")", ";", "NodeRewriteEvent", "event", "=", "(", "NodeRewriteEvent", ")", "getEvent", "(", "parent", ",", "childProperty", ")", ";", "if", "(", "event", "==", "null", "&&", "forceCreation", ")", "{", "Object", "originalValue", "=", "accessOriginalValue", "(", "parent", ",", "childProperty", ")", ";", "event", "=", "new", "NodeRewriteEvent", "(", "originalValue", ",", "originalValue", ")", ";", "addEvent", "(", "parent", ",", "childProperty", ",", "event", ")", ";", "}", "return", "event", ";", "}", "public", "ListRewriteEvent", "getListEvent", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "boolean", "forceCreation", ")", "{", "validateIsListProperty", "(", "childProperty", ")", ";", "ListRewriteEvent", "event", "=", "(", "ListRewriteEvent", ")", "getEvent", "(", "parent", ",", "childProperty", ")", ";", "if", "(", "event", "==", "null", "&&", "forceCreation", ")", "{", "List", "originalValue", "=", "(", "List", ")", "accessOriginalValue", "(", "parent", ",", "childProperty", ")", ";", "event", "=", "new", "ListRewriteEvent", "(", "originalValue", ")", ";", "addEvent", "(", "parent", ",", "childProperty", ",", "event", ")", ";", "}", "return", "event", ";", "}", "public", "Iterator", "getChangeRootIterator", "(", ")", "{", "return", "new", "ParentIterator", "(", ")", ";", "}", "public", "boolean", "hasChangedProperties", "(", "ASTNode", "parent", ")", "{", "List", "entriesList", "=", "(", "List", ")", "this", ".", "eventLookup", ".", "get", "(", "parent", ")", ";", "if", "(", "entriesList", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entriesList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "EventHolder", "holder", "=", "(", "EventHolder", ")", "entriesList", ".", "get", "(", "i", ")", ";", "if", "(", "holder", ".", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "public", "PropertyLocation", "getPropertyLocation", "(", "Object", "value", ",", "int", "kind", ")", "{", "for", "(", "Iterator", "iter", "=", "this", ".", "eventLookup", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "List", "events", "=", "(", "List", ")", "iter", ".", "next", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "size", "(", ")", ";", "i", "++", ")", "{", "EventHolder", "holder", "=", "(", "EventHolder", ")", "events", ".", "get", "(", "i", ")", ";", "RewriteEvent", "event", "=", "holder", ".", "event", ";", "if", "(", "isNodeInEvent", "(", "event", ",", "value", ",", "kind", ")", ")", "{", "return", "new", "PropertyLocation", "(", "holder", ".", "parent", ",", "holder", ".", "childProperty", ")", ";", "}", "if", "(", "event", ".", "isListRewrite", "(", ")", ")", "{", "RewriteEvent", "[", "]", "children", "=", "event", ".", "getChildren", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "children", ".", "length", ";", "k", "++", ")", "{", "if", "(", "isNodeInEvent", "(", "children", "[", "k", "]", ",", "value", ",", "kind", ")", ")", "{", "return", "new", "PropertyLocation", "(", "holder", ".", "parent", ",", "holder", ".", "childProperty", ")", ";", "}", "}", "}", "}", "}", "if", "(", "value", "instanceof", "ASTNode", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "value", ";", "return", "new", "PropertyLocation", "(", "node", ".", "getParent", "(", ")", ",", "node", ".", "getLocationInParent", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "RewriteEvent", "findEvent", "(", "Object", "value", ",", "int", "kind", ")", "{", "for", "(", "Iterator", "iter", "=", "this", ".", "eventLookup", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "List", "events", "=", "(", "List", ")", "iter", ".", "next", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RewriteEvent", "event", "=", "(", "(", "EventHolder", ")", "events", ".", "get", "(", "i", ")", ")", ".", "event", ";", "if", "(", "isNodeInEvent", "(", "event", ",", "value", ",", "kind", ")", ")", "{", "return", "event", ";", "}", "if", "(", "event", ".", "isListRewrite", "(", ")", ")", "{", "RewriteEvent", "[", "]", "children", "=", "event", ".", "getChildren", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "children", ".", "length", ";", "k", "++", ")", "{", "if", "(", "isNodeInEvent", "(", "children", "[", "k", "]", ",", "value", ",", "kind", ")", ")", "{", "return", "children", "[", "k", "]", ";", "}", "}", "}", "}", "}", "return", "null", ";", "}", "private", "boolean", "isNodeInEvent", "(", "RewriteEvent", "event", ",", "Object", "value", ",", "int", "kind", ")", "{", "if", "(", "(", "(", "kind", "&", "NEW", ")", "!=", "0", ")", "&&", "event", ".", "getNewValue", "(", ")", "==", "value", ")", "{", "return", "true", ";", "}", "if", "(", "(", "(", "kind", "&", "ORIGINAL", ")", "!=", "0", ")", "&&", "event", ".", "getOriginalValue", "(", ")", "==", "value", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}", "public", "Object", "getOriginalValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "event", ".", "getOriginalValue", "(", ")", ";", "}", "return", "accessOriginalValue", "(", "parent", ",", "property", ")", ";", "}", "public", "Object", "getNewValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", "parent", ",", "property", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "event", ".", "getNewValue", "(", ")", ";", "}", "return", "accessOriginalValue", "(", "parent", ",", "property", ")", ";", "}", "public", "List", "getChangedPropertieEvents", "(", "ASTNode", "parent", ")", "{", "List", "changedPropertiesEvent", "=", "new", "ArrayList", "(", ")", ";", "List", "entriesList", "=", "(", "List", ")", "this", ".", "eventLookup", ".", "get", "(", "parent", ")", ";", "if", "(", "entriesList", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entriesList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "EventHolder", "holder", "=", "(", "EventHolder", ")", "entriesList", ".", "get", "(", "i", ")", ";", "if", "(", "holder", ".", "event", ".", "getChangeKind", "(", ")", "!=", "RewriteEvent", ".", "UNCHANGED", ")", "{", "changedPropertiesEvent", ".", "add", "(", "holder", ".", "event", ")", ";", "}", "}", "}", "return", "changedPropertiesEvent", ";", "}", "public", "int", "getChangeKind", "(", "ASTNode", "node", ")", "{", "RewriteEvent", "event", "=", "findEvent", "(", "node", ",", "ORIGINAL", ")", ";", "if", "(", "event", "!=", "null", ")", "{", "return", "event", ".", "getChangeKind", "(", ")", ";", "}", "return", "RewriteEvent", ".", "UNCHANGED", ";", "}", "private", "Object", "accessOriginalValue", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "if", "(", "this", ".", "nodePropertyMapper", "!=", "null", ")", "{", "return", "this", ".", "nodePropertyMapper", ".", "getOriginalValue", "(", "parent", ",", "childProperty", ")", ";", "}", "return", "parent", ".", "getStructuralProperty", "(", "childProperty", ")", ";", "}", "public", "TextEditGroup", "getEventEditGroup", "(", "RewriteEvent", "event", ")", "{", "if", "(", "this", ".", "editGroups", "==", "null", ")", "{", "return", "null", ";", "}", "return", "(", "TextEditGroup", ")", "this", ".", "editGroups", ".", "get", "(", "event", ")", ";", "}", "public", "void", "setEventEditGroup", "(", "RewriteEvent", "event", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "this", ".", "editGroups", "==", "null", ")", "{", "this", ".", "editGroups", "=", "new", "IdentityHashMap", "(", "5", ")", ";", "}", "this", ".", "editGroups", ".", "put", "(", "event", ",", "editGroup", ")", ";", "}", "public", "final", "TextEditGroup", "getTrackedNodeData", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "trackedNodes", "!=", "null", ")", "{", "return", "(", "TextEditGroup", ")", "this", ".", "trackedNodes", ".", "get", "(", "node", ")", ";", "}", "return", "null", ";", "}", "public", "void", "setTrackedNodeData", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "this", ".", "trackedNodes", "==", "null", ")", "{", "this", ".", "trackedNodes", "=", "new", "IdentityHashMap", "(", ")", ";", "}", "this", ".", "trackedNodes", ".", "put", "(", "node", ",", "editGroup", ")", ";", "}", "public", "final", "void", "markAsTracked", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "getTrackedNodeData", "(", "node", ")", "!=", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "setTrackedNodeData", "(", "node", ",", "editGroup", ")", ";", "}", "private", "final", "CopySourceInfo", "createCopySourceInfo", "(", "PropertyLocation", "location", ",", "ASTNode", "node", ",", "boolean", "isMove", ")", "{", "CopySourceInfo", "copySource", "=", "new", "CopySourceInfo", "(", "location", ",", "node", ",", "isMove", ")", ";", "if", "(", "this", ".", "nodeCopySources", "==", "null", ")", "{", "this", ".", "nodeCopySources", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "nodeCopySources", ".", "add", "(", "copySource", ")", ";", "return", "copySource", ";", "}", "public", "final", "CopySourceInfo", "markAsCopySource", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ",", "ASTNode", "node", ",", "boolean", "isMove", ")", "{", "return", "createCopySourceInfo", "(", "new", "PropertyLocation", "(", "parent", ",", "property", ")", ",", "node", ",", "isMove", ")", ";", "}", "public", "final", "boolean", "isRangeCopyPlaceholder", "(", "ASTNode", "node", ")", "{", "return", "node", ".", "getProperty", "(", "INTERNAL_PLACEHOLDER_PROPERTY", ")", "!=", "null", ";", "}", "public", "final", "CopySourceInfo", "createRangeCopy", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ",", "ASTNode", "first", ",", "ASTNode", "last", ",", "boolean", "isMove", ",", "ASTNode", "internalPlaceholder", ",", "ASTNode", "replacingNode", ",", "TextEditGroup", "editGroup", ")", "{", "CopySourceInfo", "copyInfo", "=", "createCopySourceInfo", "(", "null", ",", "internalPlaceholder", ",", "isMove", ")", ";", "internalPlaceholder", ".", "setProperty", "(", "INTERNAL_PLACEHOLDER_PROPERTY", ",", "internalPlaceholder", ")", ";", "NodeRangeInfo", "copyRangeInfo", "=", "new", "NodeRangeInfo", "(", "parent", ",", "childProperty", ",", "first", ",", "last", ",", "copyInfo", ",", "replacingNode", ",", "editGroup", ")", ";", "ListRewriteEvent", "listEvent", "=", "getListEvent", "(", "parent", ",", "childProperty", ",", "true", ")", ";", "int", "indexFirst", "=", "listEvent", ".", "getIndex", "(", "first", ",", "ListRewriteEvent", ".", "OLD", ")", ";", "if", "(", "indexFirst", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "int", "indexLast", "=", "listEvent", ".", "getIndex", "(", "last", ",", "ListRewriteEvent", ".", "OLD", ")", ";", "if", "(", "indexLast", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "if", "(", "indexFirst", ">", "indexLast", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "nodeRangeInfos", "==", "null", ")", "{", "this", ".", "nodeRangeInfos", "=", "new", "HashMap", "(", ")", ";", "}", "PropertyLocation", "loc", "=", "new", "PropertyLocation", "(", "parent", ",", "childProperty", ")", ";", "List", "innerList", "=", "(", "List", ")", "this", ".", "nodeRangeInfos", ".", "get", "(", "loc", ")", ";", "if", "(", "innerList", "==", "null", ")", "{", "innerList", "=", "new", "ArrayList", "(", "2", ")", ";", "this", ".", "nodeRangeInfos", ".", "put", "(", "loc", ",", "innerList", ")", ";", "}", "else", "{", "assertNoOverlap", "(", "listEvent", ",", "indexFirst", ",", "indexLast", ",", "innerList", ")", ";", "}", "innerList", ".", "add", "(", "copyRangeInfo", ")", ";", "return", "copyInfo", ";", "}", "public", "CopySourceInfo", "[", "]", "getNodeCopySources", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "nodeCopySources", "==", "null", ")", "{", "return", "null", ";", "}", "return", "internalGetCopySources", "(", "this", ".", "nodeCopySources", ",", "node", ")", ";", "}", "public", "CopySourceInfo", "[", "]", "internalGetCopySources", "(", "List", "copySources", ",", "ASTNode", "node", ")", "{", "ArrayList", "res", "=", "new", "ArrayList", "(", "3", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copySources", ".", "size", "(", ")", ";", "i", "++", ")", "{", "CopySourceInfo", "curr", "=", "(", "CopySourceInfo", ")", "copySources", ".", "get", "(", "i", ")", ";", "if", "(", "curr", ".", "getNode", "(", ")", "==", "node", ")", "{", "res", ".", "add", "(", "curr", ")", ";", "}", "}", "if", "(", "res", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "CopySourceInfo", "[", "]", "arr", "=", "(", "CopySourceInfo", "[", "]", ")", "res", ".", "toArray", "(", "new", "CopySourceInfo", "[", "res", ".", "size", "(", ")", "]", ")", ";", "Arrays", ".", "sort", "(", "arr", ")", ";", "return", "arr", ";", "}", "private", "void", "assertNoOverlap", "(", "ListRewriteEvent", "listEvent", ",", "int", "indexFirst", ",", "int", "indexLast", ",", "List", "innerList", ")", "{", "for", "(", "Iterator", "iter", "=", "innerList", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "NodeRangeInfo", "curr", "=", "(", "NodeRangeInfo", ")", "iter", ".", "next", "(", ")", ";", "int", "currStart", "=", "listEvent", ".", "getIndex", "(", "curr", ".", "getStartNode", "(", ")", ",", "ListRewriteEvent", ".", "BOTH", ")", ";", "int", "currEnd", "=", "listEvent", ".", "getIndex", "(", "curr", ".", "getEndNode", "(", ")", ",", "ListRewriteEvent", ".", "BOTH", ")", ";", "if", "(", "currStart", "<", "indexFirst", "&&", "currEnd", "<", "indexLast", "&&", "currEnd", ">=", "indexFirst", "||", "currStart", ">", "indexFirst", "&&", "currStart", "<=", "currEnd", "&&", "currEnd", ">", "indexLast", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "}", "public", "void", "prepareMovedNodes", "(", "TargetSourceRangeComputer", "sourceRangeComputer", ")", "{", "if", "(", "this", ".", "nodeCopySources", "!=", "null", ")", "{", "prepareSingleNodeCopies", "(", ")", ";", "}", "if", "(", "this", ".", "nodeRangeInfos", "!=", "null", ")", "{", "prepareNodeRangeCopies", "(", "sourceRangeComputer", ")", ";", "}", "}", "public", "void", "revertMovedNodes", "(", ")", "{", "if", "(", "this", ".", "nodeRangeInfos", "!=", "null", ")", "{", "removeMoveRangePlaceholders", "(", ")", ";", "}", "}", "private", "void", "removeMoveRangePlaceholders", "(", ")", "{", "for", "(", "Iterator", "iter", "=", "this", ".", "nodeRangeInfos", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "Set", "placeholders", "=", "new", "HashSet", "(", ")", ";", "List", "rangeInfos", "=", "(", "List", ")", "entry", ".", "getValue", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rangeInfos", ".", "size", "(", ")", ";", "i", "++", ")", "{", "placeholders", ".", "add", "(", "(", "(", "NodeRangeInfo", ")", "rangeInfos", ".", "get", "(", "i", ")", ")", ".", "getInternalPlaceholder", "(", ")", ")", ";", "}", "PropertyLocation", "loc", "=", "(", "PropertyLocation", ")", "entry", ".", "getKey", "(", ")", ";", "RewriteEvent", "[", "]", "children", "=", "getListEvent", "(", "loc", ".", "getParent", "(", ")", ",", "loc", ".", "getProperty", "(", ")", ",", "true", ")", ".", "getChildren", "(", ")", ";", "List", "revertedChildren", "=", "new", "ArrayList", "(", ")", ";", "revertListWithRanges", "(", "children", ",", "placeholders", ",", "revertedChildren", ")", ";", "RewriteEvent", "[", "]", "revertedChildrenArr", "=", "(", "RewriteEvent", "[", "]", ")", "revertedChildren", ".", "toArray", "(", "new", "RewriteEvent", "[", "revertedChildren", ".", "size", "(", ")", "]", ")", ";", "addEvent", "(", "loc", ".", "getParent", "(", ")", ",", "loc", ".", "getProperty", "(", ")", ",", "new", "ListRewriteEvent", "(", "revertedChildrenArr", ")", ")", ";", "}", "}", "private", "void", "revertListWithRanges", "(", "RewriteEvent", "[", "]", "childEvents", ",", "Set", "placeholders", ",", "List", "revertedChildren", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childEvents", ".", "length", ";", "i", "++", ")", "{", "RewriteEvent", "event", "=", "childEvents", "[", "i", "]", ";", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "if", "(", "placeholders", ".", "contains", "(", "node", ")", ")", "{", "RewriteEvent", "[", "]", "placeholderChildren", "=", "getListEvent", "(", "node", ",", "Block", ".", "STATEMENTS_PROPERTY", ",", "false", ")", ".", "getChildren", "(", ")", ";", "revertListWithRanges", "(", "placeholderChildren", ",", "placeholders", ",", "revertedChildren", ")", ";", "}", "else", "{", "revertedChildren", ".", "add", "(", "event", ")", ";", "}", "}", "}", "private", "void", "prepareNodeRangeCopies", "(", "TargetSourceRangeComputer", "sourceRangeComputer", ")", "{", "for", "(", "Iterator", "iter", "=", "this", ".", "nodeRangeInfos", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "List", "rangeInfos", "=", "(", "List", ")", "entry", ".", "getValue", "(", ")", ";", "Collections", ".", "sort", "(", "rangeInfos", ")", ";", "PropertyLocation", "loc", "=", "(", "PropertyLocation", ")", "entry", ".", "getKey", "(", ")", ";", "RewriteEvent", "[", "]", "children", "=", "getListEvent", "(", "loc", ".", "getParent", "(", ")", ",", "loc", ".", "getProperty", "(", ")", ",", "true", ")", ".", "getChildren", "(", ")", ";", "RewriteEvent", "[", "]", "newChildren", "=", "processListWithRanges", "(", "rangeInfos", ",", "children", ",", "sourceRangeComputer", ")", ";", "addEvent", "(", "loc", ".", "getParent", "(", ")", ",", "loc", ".", "getProperty", "(", ")", ",", "new", "ListRewriteEvent", "(", "newChildren", ")", ")", ";", "}", "}", "private", "RewriteEvent", "[", "]", "processListWithRanges", "(", "List", "rangeInfos", ",", "RewriteEvent", "[", "]", "childEvents", ",", "TargetSourceRangeComputer", "sourceRangeComputer", ")", "{", "List", "newChildEvents", "=", "new", "ArrayList", "(", "childEvents", ".", "length", ")", ";", "NodeRangeInfo", "topInfo", "=", "null", ";", "Stack", "newChildrenStack", "=", "new", "Stack", "(", ")", ";", "Stack", "topInfoStack", "=", "new", "Stack", "(", ")", ";", "Iterator", "rangeInfoIterator", "=", "rangeInfos", ".", "iterator", "(", ")", ";", "NodeRangeInfo", "nextInfo", "=", "(", "NodeRangeInfo", ")", "rangeInfoIterator", ".", "next", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "childEvents", ".", "length", ";", "k", "++", ")", "{", "RewriteEvent", "event", "=", "childEvents", "[", "k", "]", ";", "ASTNode", "node", "=", "(", "ASTNode", ")", "event", ".", "getOriginalValue", "(", ")", ";", "while", "(", "nextInfo", "!=", "null", "&&", "node", "==", "nextInfo", ".", "getStartNode", "(", ")", ")", "{", "nextInfo", ".", "updatePlaceholderSourceRanges", "(", "sourceRangeComputer", ")", ";", "Block", "internalPlaceholder", "=", "nextInfo", ".", "getInternalPlaceholder", "(", ")", ";", "RewriteEvent", "newEvent", ";", "if", "(", "nextInfo", ".", "isMove", "(", ")", ")", "{", "newEvent", "=", "new", "NodeRewriteEvent", "(", "internalPlaceholder", ",", "nextInfo", ".", "replacingNode", ")", ";", "}", "else", "{", "newEvent", "=", "new", "NodeRewriteEvent", "(", "internalPlaceholder", ",", "internalPlaceholder", ")", ";", "}", "newChildEvents", ".", "add", "(", "newEvent", ")", ";", "if", "(", "nextInfo", ".", "editGroup", "!=", "null", ")", "{", "setEventEditGroup", "(", "newEvent", ",", "nextInfo", ".", "editGroup", ")", ";", "}", "newChildrenStack", ".", "push", "(", "newChildEvents", ")", ";", "topInfoStack", ".", "push", "(", "topInfo", ")", ";", "newChildEvents", "=", "new", "ArrayList", "(", "childEvents", ".", "length", ")", ";", "topInfo", "=", "nextInfo", ";", "nextInfo", "=", "rangeInfoIterator", ".", "hasNext", "(", ")", "?", "(", "NodeRangeInfo", ")", "rangeInfoIterator", ".", "next", "(", ")", ":", "null", ";", "}", "newChildEvents", ".", "add", "(", "event", ")", ";", "while", "(", "topInfo", "!=", "null", "&&", "node", "==", "topInfo", ".", "getEndNode", "(", ")", ")", "{", "RewriteEvent", "[", "]", "placeholderChildEvents", "=", "(", "RewriteEvent", "[", "]", ")", "newChildEvents", ".", "toArray", "(", "new", "RewriteEvent", "[", "newChildEvents", ".", "size", "(", ")", "]", ")", ";", "Block", "internalPlaceholder", "=", "topInfo", ".", "getInternalPlaceholder", "(", ")", ";", "addEvent", "(", "internalPlaceholder", ",", "Block", ".", "STATEMENTS_PROPERTY", ",", "new", "ListRewriteEvent", "(", "placeholderChildEvents", ")", ")", ";", "newChildEvents", "=", "(", "List", ")", "newChildrenStack", ".", "pop", "(", ")", ";", "topInfo", "=", "(", "NodeRangeInfo", ")", "topInfoStack", ".", "pop", "(", ")", ";", "}", "}", "return", "(", "RewriteEvent", "[", "]", ")", "newChildEvents", ".", "toArray", "(", "new", "RewriteEvent", "[", "newChildEvents", ".", "size", "(", ")", "]", ")", ";", "}", "private", "void", "prepareSingleNodeCopies", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "nodeCopySources", ".", "size", "(", ")", ";", "i", "++", ")", "{", "CopySourceInfo", "curr", "=", "(", "CopySourceInfo", ")", "this", ".", "nodeCopySources", ".", "get", "(", "i", ")", ";", "if", "(", "curr", ".", "isMove", "&&", "curr", ".", "location", "!=", "null", ")", "{", "doMarkMovedAsRemoved", "(", "curr", ",", "curr", ".", "location", ".", "getParent", "(", ")", ",", "curr", ".", "location", ".", "getProperty", "(", ")", ")", ";", "}", "}", "}", "private", "void", "doMarkMovedAsRemoved", "(", "CopySourceInfo", "curr", ",", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "if", "(", "childProperty", ".", "isChildListProperty", "(", ")", ")", "{", "ListRewriteEvent", "event", "=", "getListEvent", "(", "parent", ",", "childProperty", ",", "true", ")", ";", "int", "index", "=", "event", ".", "getIndex", "(", "curr", ".", "getNode", "(", ")", ",", "ListRewriteEvent", ".", "OLD", ")", ";", "if", "(", "index", "!=", "-", "1", "&&", "event", ".", "getChangeKind", "(", "index", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "event", ".", "setNewValue", "(", "null", ",", "index", ")", ";", "}", "}", "else", "{", "NodeRewriteEvent", "event", "=", "getNodeEvent", "(", "parent", ",", "childProperty", ",", "true", ")", ";", "if", "(", "event", ".", "getChangeKind", "(", ")", "==", "RewriteEvent", ".", "UNCHANGED", ")", "{", "event", ".", "setNewValue", "(", "null", ")", ";", "}", "}", "}", "public", "boolean", "isInsertBoundToPrevious", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "insertBoundToPrevious", "!=", "null", ")", "{", "return", "this", ".", "insertBoundToPrevious", ".", "contains", "(", "node", ")", ";", "}", "return", "false", ";", "}", "public", "void", "setInsertBoundToPrevious", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "insertBoundToPrevious", "==", "null", ")", "{", "this", ".", "insertBoundToPrevious", "=", "new", "HashSet", "(", ")", ";", "}", "this", ".", "insertBoundToPrevious", ".", "add", "(", "node", ")", ";", "}", "private", "void", "validateIsListProperty", "(", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "!", "property", ".", "isChildListProperty", "(", ")", ")", "{", "String", "message", "=", "property", ".", "getId", "(", ")", "+", "\"\"", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "private", "void", "validateHasChildProperty", "(", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "!", "parent", ".", "structuralPropertiesForType", "(", ")", ".", "contains", "(", "property", ")", ")", "{", "String", "message", "=", "Signature", ".", "getSimpleName", "(", "parent", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", "+", "\"\"", "+", "property", ".", "getId", "(", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "private", "void", "validateIsNodeProperty", "(", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "String", "message", "=", "property", ".", "getId", "(", ")", "+", "\"\"", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "this", ".", "eventLookup", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "List", "events", "=", "(", "List", ")", "iter", ".", "next", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "size", "(", ")", ";", "i", "++", ")", "{", "buf", ".", "append", "(", "events", ".", "get", "(", "i", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "public", "static", "boolean", "isNewNode", "(", "ASTNode", "node", ")", "{", "return", "(", "node", ".", "getFlags", "(", ")", "&", "ASTNode", ".", "ORIGINAL", ")", "==", "0", ";", "}", "}", "</s>" ]
2,325
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Status", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "public", "class", "TokenScanner", "{", "public", "static", "final", "int", "END_OF_FILE", "=", "20001", ";", "public", "static", "final", "int", "LEXICAL_ERROR", "=", "20002", ";", "public", "static", "final", "int", "DOCUMENT_ERROR", "=", "20003", ";", "private", "final", "Scanner", "scanner", ";", "private", "final", "int", "endPosition", ";", "public", "TokenScanner", "(", "Scanner", "scanner", ")", "{", "this", ".", "scanner", "=", "scanner", ";", "this", ".", "endPosition", "=", "this", ".", "scanner", ".", "getSource", "(", ")", ".", "length", "-", "1", ";", "}", "public", "Scanner", "getScanner", "(", ")", "{", "return", "this", ".", "scanner", ";", "}", "public", "void", "setOffset", "(", "int", "offset", ")", "{", "this", ".", "scanner", ".", "resetTo", "(", "offset", ",", "this", ".", "endPosition", ")", ";", "}", "public", "int", "getCurrentEndOffset", "(", ")", "{", "return", "this", ".", "scanner", ".", "getCurrentTokenEndPosition", "(", ")", "+", "1", ";", "}", "public", "int", "getCurrentStartOffset", "(", ")", "{", "return", "this", ".", "scanner", ".", "getCurrentTokenStartPosition", "(", ")", ";", "}", "public", "int", "getCurrentLength", "(", ")", "{", "return", "getCurrentEndOffset", "(", ")", "-", "getCurrentStartOffset", "(", ")", ";", "}", "public", "int", "readNext", "(", "boolean", "ignoreComments", ")", "throws", "CoreException", "{", "int", "curr", "=", "0", ";", "do", "{", "try", "{", "curr", "=", "this", ".", "scanner", ".", "getNextToken", "(", ")", ";", "if", "(", "curr", "==", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "throw", "new", "CoreException", "(", "createError", "(", "END_OF_FILE", ",", "\"End", "Of", "File\"", ",", "null", ")", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "throw", "new", "CoreException", "(", "createError", "(", "LEXICAL_ERROR", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ")", ";", "}", "}", "while", "(", "ignoreComments", "&&", "isComment", "(", "curr", ")", ")", ";", "return", "curr", ";", "}", "public", "int", "readNext", "(", "int", "offset", ",", "boolean", "ignoreComments", ")", "throws", "CoreException", "{", "setOffset", "(", "offset", ")", ";", "return", "readNext", "(", "ignoreComments", ")", ";", "}", "public", "int", "getNextStartOffset", "(", "int", "offset", ",", "boolean", "ignoreComments", ")", "throws", "CoreException", "{", "readNext", "(", "offset", ",", "ignoreComments", ")", ";", "return", "getCurrentStartOffset", "(", ")", ";", "}", "public", "int", "getNextEndOffset", "(", "int", "offset", ",", "boolean", "ignoreComments", ")", "throws", "CoreException", "{", "readNext", "(", "offset", ",", "ignoreComments", ")", ";", "return", "getCurrentEndOffset", "(", ")", ";", "}", "public", "void", "readToToken", "(", "int", "tok", ")", "throws", "CoreException", "{", "int", "curr", "=", "0", ";", "do", "{", "curr", "=", "readNext", "(", "false", ")", ";", "}", "while", "(", "curr", "!=", "tok", ")", ";", "}", "public", "void", "readToToken", "(", "int", "tok", ",", "int", "offset", ")", "throws", "CoreException", "{", "setOffset", "(", "offset", ")", ";", "readToToken", "(", "tok", ")", ";", "}", "public", "int", "getTokenStartOffset", "(", "int", "token", ",", "int", "startOffset", ")", "throws", "CoreException", "{", "readToToken", "(", "token", ",", "startOffset", ")", ";", "return", "getCurrentStartOffset", "(", ")", ";", "}", "public", "int", "getTokenEndOffset", "(", "int", "token", ",", "int", "startOffset", ")", "throws", "CoreException", "{", "readToToken", "(", "token", ",", "startOffset", ")", ";", "return", "getCurrentEndOffset", "(", ")", ";", "}", "public", "int", "getPreviousTokenEndOffset", "(", "int", "token", ",", "int", "startOffset", ")", "throws", "CoreException", "{", "setOffset", "(", "startOffset", ")", ";", "int", "res", "=", "startOffset", ";", "int", "curr", "=", "readNext", "(", "false", ")", ";", "while", "(", "curr", "!=", "token", ")", "{", "res", "=", "getCurrentEndOffset", "(", ")", ";", "curr", "=", "readNext", "(", "false", ")", ";", "}", "return", "res", ";", "}", "public", "static", "boolean", "isComment", "(", "int", "token", ")", "{", "return", "token", "==", "TerminalTokens", ".", "TokenNameCOMMENT_BLOCK", "||", "token", "==", "TerminalTokens", ".", "TokenNameCOMMENT_JAVADOC", "||", "token", "==", "TerminalTokens", ".", "TokenNameCOMMENT_LINE", ";", "}", "public", "static", "boolean", "isModifier", "(", "int", "token", ")", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNamepublic", ":", "case", "TerminalTokens", ".", "TokenNameprotected", ":", "case", "TerminalTokens", ".", "TokenNameprivate", ":", "case", "TerminalTokens", ".", "TokenNamestatic", ":", "case", "TerminalTokens", ".", "TokenNamefinal", ":", "case", "TerminalTokens", ".", "TokenNameabstract", ":", "case", "TerminalTokens", ".", "TokenNamenative", ":", "case", "TerminalTokens", ".", "TokenNamevolatile", ":", "case", "TerminalTokens", ".", "TokenNamestrictfp", ":", "case", "TerminalTokens", ".", "TokenNametransient", ":", "case", "TerminalTokens", ".", "TokenNamesynchronized", ":", "return", "true", ";", "default", ":", "return", "false", ";", "}", "}", "public", "static", "IStatus", "createError", "(", "int", "code", ",", "String", "message", ",", "Throwable", "throwable", ")", "{", "return", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "message", ",", "throwable", ")", ";", "}", "}", "</s>" ]
2,326
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "public", "class", "ListRewriteEvent", "extends", "RewriteEvent", "{", "public", "final", "static", "int", "NEW", "=", "1", ";", "public", "final", "static", "int", "OLD", "=", "2", ";", "public", "final", "static", "int", "BOTH", "=", "NEW", "|", "OLD", ";", "private", "List", "originalNodes", ";", "private", "List", "listEntries", ";", "public", "ListRewriteEvent", "(", "List", "originalNodes", ")", "{", "this", ".", "originalNodes", "=", "new", "ArrayList", "(", "originalNodes", ")", ";", "}", "public", "ListRewriteEvent", "(", "RewriteEvent", "[", "]", "children", ")", "{", "this", ".", "listEntries", "=", "new", "ArrayList", "(", "children", ".", "length", "*", "2", ")", ";", "this", ".", "originalNodes", "=", "new", "ArrayList", "(", "children", ".", "length", "*", "2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "RewriteEvent", "curr", "=", "children", "[", "i", "]", ";", "this", ".", "listEntries", ".", "add", "(", "curr", ")", ";", "if", "(", "curr", ".", "getOriginalValue", "(", ")", "!=", "null", ")", "{", "this", ".", "originalNodes", ".", "add", "(", "curr", ".", "getOriginalValue", "(", ")", ")", ";", "}", "}", "}", "private", "List", "getEntries", "(", ")", "{", "if", "(", "this", ".", "listEntries", "==", "null", ")", "{", "int", "nNodes", "=", "this", ".", "originalNodes", ".", "size", "(", ")", ";", "this", ".", "listEntries", "=", "new", "ArrayList", "(", "nNodes", "*", "2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nNodes", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "this", ".", "originalNodes", ".", "get", "(", "i", ")", ";", "this", ".", "listEntries", ".", "add", "(", "new", "NodeRewriteEvent", "(", "node", ",", "node", ")", ")", ";", "}", "}", "return", "this", ".", "listEntries", ";", "}", "public", "int", "getChangeKind", "(", ")", "{", "if", "(", "this", ".", "listEntries", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "listEntries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RewriteEvent", "curr", "=", "(", "RewriteEvent", ")", "this", ".", "listEntries", ".", "get", "(", "i", ")", ";", "if", "(", "curr", ".", "getChangeKind", "(", ")", "!=", "UNCHANGED", ")", "{", "return", "CHILDREN_CHANGED", ";", "}", "}", "}", "return", "UNCHANGED", ";", "}", "public", "boolean", "isListRewrite", "(", ")", "{", "return", "true", ";", "}", "public", "RewriteEvent", "[", "]", "getChildren", "(", ")", "{", "List", "entries", "=", "getEntries", "(", ")", ";", "return", "(", "RewriteEvent", "[", "]", ")", "entries", ".", "toArray", "(", "new", "RewriteEvent", "[", "entries", ".", "size", "(", ")", "]", ")", ";", "}", "public", "Object", "getOriginalValue", "(", ")", "{", "return", "this", ".", "originalNodes", ";", "}", "public", "Object", "getNewValue", "(", ")", "{", "List", "entries", "=", "getEntries", "(", ")", ";", "ArrayList", "res", "=", "new", "ArrayList", "(", "entries", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RewriteEvent", "curr", "=", "(", "RewriteEvent", ")", "entries", ".", "get", "(", "i", ")", ";", "Object", "newVal", "=", "curr", ".", "getNewValue", "(", ")", ";", "if", "(", "newVal", "!=", "null", ")", "{", "res", ".", "add", "(", "newVal", ")", ";", "}", "}", "return", "res", ";", "}", "public", "RewriteEvent", "removeEntry", "(", "ASTNode", "originalEntry", ")", "{", "return", "replaceEntry", "(", "originalEntry", ",", "null", ")", ";", "}", "public", "RewriteEvent", "replaceEntry", "(", "ASTNode", "entry", ",", "ASTNode", "newEntry", ")", "{", "if", "(", "entry", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "List", "entries", "=", "getEntries", "(", ")", ";", "int", "nEntries", "=", "entries", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nEntries", ";", "i", "++", ")", "{", "NodeRewriteEvent", "curr", "=", "(", "NodeRewriteEvent", ")", "entries", ".", "get", "(", "i", ")", ";", "if", "(", "curr", ".", "getOriginalValue", "(", ")", "==", "entry", "||", "curr", ".", "getNewValue", "(", ")", "==", "entry", ")", "{", "curr", ".", "setNewValue", "(", "newEntry", ")", ";", "if", "(", "curr", ".", "getNewValue", "(", ")", "==", "null", "&&", "curr", ".", "getOriginalValue", "(", ")", "==", "null", ")", "{", "entries", ".", "remove", "(", "i", ")", ";", "return", "null", ";", "}", "return", "curr", ";", "}", "}", "return", "null", ";", "}", "public", "void", "revertChange", "(", "NodeRewriteEvent", "event", ")", "{", "Object", "originalValue", "=", "event", ".", "getOriginalValue", "(", ")", ";", "if", "(", "originalValue", "==", "null", ")", "{", "List", "entries", "=", "getEntries", "(", ")", ";", "entries", ".", "remove", "(", "event", ")", ";", "}", "else", "{", "event", ".", "setNewValue", "(", "originalValue", ")", ";", "}", "}", "public", "int", "getIndex", "(", "ASTNode", "node", ",", "int", "kind", ")", "{", "List", "entries", "=", "getEntries", "(", ")", ";", "for", "(", "int", "i", "=", "entries", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "RewriteEvent", "curr", "=", "(", "RewriteEvent", ")", "entries", ".", "get", "(", "i", ")", ";", "if", "(", "(", "(", "kind", "&", "OLD", ")", "!=", "0", ")", "&&", "(", "curr", ".", "getOriginalValue", "(", ")", "==", "node", ")", ")", "{", "return", "i", ";", "}", "if", "(", "(", "(", "kind", "&", "NEW", ")", "!=", "0", ")", "&&", "(", "curr", ".", "getNewValue", "(", ")", "==", "node", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}", "public", "RewriteEvent", "insert", "(", "ASTNode", "insertedNode", ",", "int", "insertIndex", ")", "{", "NodeRewriteEvent", "change", "=", "new", "NodeRewriteEvent", "(", "null", ",", "insertedNode", ")", ";", "if", "(", "insertIndex", "!=", "-", "1", ")", "{", "getEntries", "(", ")", ".", "add", "(", "insertIndex", ",", "change", ")", ";", "}", "else", "{", "getEntries", "(", ")", ".", "add", "(", "change", ")", ";", "}", "return", "change", ";", "}", "public", "void", "setNewValue", "(", "ASTNode", "newValue", ",", "int", "insertIndex", ")", "{", "NodeRewriteEvent", "curr", "=", "(", "NodeRewriteEvent", ")", "getEntries", "(", ")", ".", "get", "(", "insertIndex", ")", ";", "curr", ".", "setNewValue", "(", "newValue", ")", ";", "}", "public", "int", "getChangeKind", "(", "int", "index", ")", "{", "return", "(", "(", "NodeRewriteEvent", ")", "getEntries", "(", ")", ".", "get", "(", "index", ")", ")", ".", "getChangeKind", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "\"\"", ")", ";", "RewriteEvent", "[", "]", "events", "=", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "{", "buf", ".", "append", "(", "\"nt\"", ")", ";", "}", "buf", ".", "append", "(", "events", "[", "i", "]", ")", ";", "}", "buf", ".", "append", "(", "\"n]\"", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,327
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "IdentityHashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Block", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Modifier", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ParameterizedType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TryStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "CopySourceInfo", ";", "public", "final", "class", "NodeInfoStore", "{", "private", "AST", "ast", ";", "private", "Map", "placeholderNodes", ";", "private", "Set", "collapsedNodes", ";", "public", "NodeInfoStore", "(", "AST", "ast", ")", "{", "super", "(", ")", ";", "this", ".", "ast", "=", "ast", ";", "this", ".", "placeholderNodes", "=", "null", ";", "this", ".", "collapsedNodes", "=", "null", ";", "}", "public", "final", "void", "markAsStringPlaceholder", "(", "ASTNode", "placeholder", ",", "String", "code", ")", "{", "StringPlaceholderData", "data", "=", "new", "StringPlaceholderData", "(", ")", ";", "data", ".", "code", "=", "code", ";", "setPlaceholderData", "(", "placeholder", ",", "data", ")", ";", "}", "public", "final", "void", "markAsCopyTarget", "(", "ASTNode", "target", ",", "CopySourceInfo", "copySource", ")", "{", "CopyPlaceholderData", "data", "=", "new", "CopyPlaceholderData", "(", ")", ";", "data", ".", "copySource", "=", "copySource", ";", "setPlaceholderData", "(", "target", ",", "data", ")", ";", "}", "public", "final", "ASTNode", "newPlaceholderNode", "(", "int", "nodeType", ")", "{", "try", "{", "ASTNode", "node", "=", "this", ".", "ast", ".", "createInstance", "(", "nodeType", ")", ";", "switch", "(", "node", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "FIELD_DECLARATION", ":", "(", "(", "FieldDeclaration", ")", "node", ")", ".", "fragments", "(", ")", ".", "add", "(", "this", ".", "ast", ".", "newVariableDeclarationFragment", "(", ")", ")", ";", "break", ";", "case", "ASTNode", ".", "MODIFIER", ":", "(", "(", "Modifier", ")", "node", ")", ".", "setKeyword", "(", "Modifier", ".", "ModifierKeyword", ".", "ABSTRACT_KEYWORD", ")", ";", "break", ";", "case", "ASTNode", ".", "TRY_STATEMENT", ":", "(", "(", "TryStatement", ")", "node", ")", ".", "setFinally", "(", "this", ".", "ast", ".", "newBlock", "(", ")", ")", ";", "break", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_EXPRESSION", ":", "(", "(", "VariableDeclarationExpression", ")", "node", ")", ".", "fragments", "(", ")", ".", "add", "(", "this", ".", "ast", ".", "newVariableDeclarationFragment", "(", ")", ")", ";", "break", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_STATEMENT", ":", "(", "(", "VariableDeclarationStatement", ")", "node", ")", ".", "fragments", "(", ")", ".", "add", "(", "this", ".", "ast", ".", "newVariableDeclarationFragment", "(", ")", ")", ";", "break", ";", "case", "ASTNode", ".", "PARAMETERIZED_TYPE", ":", "(", "(", "ParameterizedType", ")", "node", ")", ".", "typeArguments", "(", ")", ".", "add", "(", "this", ".", "ast", ".", "newWildcardType", "(", ")", ")", ";", "break", ";", "}", "return", "node", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "Block", "createCollapsePlaceholder", "(", ")", "{", "Block", "placeHolder", "=", "this", ".", "ast", ".", "newBlock", "(", ")", ";", "if", "(", "this", ".", "collapsedNodes", "==", "null", ")", "{", "this", ".", "collapsedNodes", "=", "new", "HashSet", "(", ")", ";", "}", "this", ".", "collapsedNodes", ".", "add", "(", "placeHolder", ")", ";", "return", "placeHolder", ";", "}", "public", "boolean", "isCollapsed", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "collapsedNodes", "!=", "null", ")", "{", "return", "this", ".", "collapsedNodes", ".", "contains", "(", "node", ")", ";", "}", "return", "false", ";", "}", "public", "Object", "getPlaceholderData", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "placeholderNodes", "!=", "null", ")", "{", "return", "this", ".", "placeholderNodes", ".", "get", "(", "node", ")", ";", "}", "return", "null", ";", "}", "private", "void", "setPlaceholderData", "(", "ASTNode", "node", ",", "PlaceholderData", "data", ")", "{", "if", "(", "this", ".", "placeholderNodes", "==", "null", ")", "{", "this", ".", "placeholderNodes", "=", "new", "IdentityHashMap", "(", ")", ";", "}", "this", ".", "placeholderNodes", ".", "put", "(", "node", ",", "data", ")", ";", "}", "static", "class", "PlaceholderData", "{", "}", "protected", "static", "final", "class", "CopyPlaceholderData", "extends", "PlaceholderData", "{", "public", "CopySourceInfo", "copySource", ";", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "copySource", "+", "\"]\"", ";", "}", "}", "protected", "static", "final", "class", "StringPlaceholderData", "extends", "PlaceholderData", "{", "public", "String", "code", ";", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "code", "+", "\"]\"", ";", "}", "}", "public", "void", "clear", "(", ")", "{", "this", ".", "placeholderNodes", "=", "null", ";", "this", ".", "collapsedNodes", "=", "null", ";", "}", "}", "</s>" ]
2,328
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AbstractTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AnnotationTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AnnotationTypeMemberDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AnonymousClassDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ArrayAccess", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ArrayCreation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ArrayInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ArrayType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AssertStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Assignment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Block", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BlockComment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BodyDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BooleanLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BreakStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CastExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CatchClause", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CharacterLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ClassInstanceCreation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ConditionalExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ConstructorInvocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ContinueStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "UnionType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "DoStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EmptyStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EnhancedForStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EnumConstantDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EnumDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ExpressionStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "FieldAccess", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ForStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "IfStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ImportDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "InfixExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Initializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "InstanceofExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Javadoc", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "LabeledStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "LineComment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MarkerAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MemberRef", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MethodInvocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MethodRef", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MethodRefParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Modifier", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Name", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "NormalAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "NullLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "NumberLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PackageDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ParameterizedType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ParenthesizedExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PostfixExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PrefixExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PrimitiveType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "QualifiedName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "QualifiedType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ReturnStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SingleMemberAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SingleVariableDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Statement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "StringLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SuperConstructorInvocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SuperFieldAccess", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SuperMethodInvocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SwitchCase", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SwitchStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SynchronizedStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TagElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TextElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ThisExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ThrowStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TryStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Type", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TypeDeclarationStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TypeLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "WhileStatement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "WildcardType", ";", "public", "class", "NaiveASTFlattener", "extends", "ASTVisitor", "{", "private", "static", "final", "int", "JLS2", "=", "AST", ".", "JLS2", ";", "private", "static", "final", "int", "JLS3", "=", "AST", ".", "JLS3", ";", "protected", "StringBuffer", "buffer", ";", "private", "int", "indent", "=", "0", ";", "public", "NaiveASTFlattener", "(", ")", "{", "this", ".", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "}", "private", "Name", "getName", "(", "ClassInstanceCreation", "node", ")", "{", "return", "node", ".", "getName", "(", ")", ";", "}", "public", "String", "getResult", "(", ")", "{", "return", "this", ".", "buffer", ".", "toString", "(", ")", ";", "}", "private", "Type", "getReturnType", "(", "MethodDeclaration", "node", ")", "{", "return", "node", ".", "getReturnType", "(", ")", ";", "}", "private", "Name", "getSuperclass", "(", "TypeDeclaration", "node", ")", "{", "return", "node", ".", "getSuperclass", "(", ")", ";", "}", "private", "TypeDeclaration", "getTypeDeclaration", "(", "TypeDeclarationStatement", "node", ")", "{", "return", "node", ".", "getTypeDeclaration", "(", ")", ";", "}", "void", "printIndent", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "indent", ";", "i", "++", ")", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "void", "printModifiers", "(", "int", "modifiers", ")", "{", "if", "(", "Modifier", ".", "isPublic", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"public", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isProtected", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"protected", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isPrivate", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"private", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isStatic", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"static", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isAbstract", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"abstract", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isFinal", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"final", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isSynchronized", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "Modifier", ".", "isVolatile", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"volatile", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isNative", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"native", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isStrictfp", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"strictfp", "\"", ")", ";", "}", "if", "(", "Modifier", ".", "isTransient", "(", "modifiers", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"transient", "\"", ")", ";", "}", "}", "void", "printModifiers", "(", "List", "ext", ")", "{", "for", "(", "Iterator", "it", "=", "ext", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "p", "=", "(", "ASTNode", ")", "it", ".", "next", "(", ")", ";", "p", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "}", "public", "void", "reset", "(", ")", "{", "this", ".", "buffer", ".", "setLength", "(", "0", ")", ";", "}", "private", "List", "superInterfaces", "(", "TypeDeclaration", "node", ")", "{", "return", "node", ".", "superInterfaces", "(", ")", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"@interface", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "{\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "bodyDeclarations", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "d", "=", "(", "BodyDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeMemberDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"()\"", ")", ";", "if", "(", "node", ".", "getDefault", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "default", "\"", ")", ";", "node", ".", "getDefault", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"{n\"", ")", ";", "this", ".", "indent", "++", ";", "for", "(", "Iterator", "it", "=", "node", ".", "bodyDeclarations", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "b", "=", "(", "BodyDeclaration", ")", "it", ".", "next", "(", ")", ";", "b", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "indent", "--", ";", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayAccess", "node", ")", "{", "node", ".", "getArray", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"[\"", ")", ";", "node", ".", "getIndex", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"]\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayCreation", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"new", "\"", ")", ";", "ArrayType", "at", "=", "node", ".", "getType", "(", ")", ";", "int", "dims", "=", "at", ".", "getDimensions", "(", ")", ";", "Type", "elementType", "=", "at", ".", "getElementType", "(", ")", ";", "elementType", ".", "accept", "(", "this", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "dimensions", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"[\"", ")", ";", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"]\"", ")", ";", "dims", "--", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dims", ";", "i", "++", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"[]\"", ")", ";", "}", "if", "(", "node", ".", "getInitializer", "(", ")", "!=", "null", ")", "{", "node", ".", "getInitializer", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayInitializer", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"{\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "expressions", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"}\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ArrayType", "node", ")", "{", "node", ".", "getComponentType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"[]\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "AssertStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"assert", "\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getMessage", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", ":", "\"", ")", ";", "node", ".", "getMessage", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Assignment", "node", ")", "{", "node", ".", "getLeftHandSide", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "node", ".", "getOperator", "(", ")", ".", "toString", "(", ")", ")", ";", "node", ".", "getRightHandSide", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Block", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"{n\"", ")", ";", "this", ".", "indent", "++", ";", "for", "(", "Iterator", "it", "=", "node", ".", "statements", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Statement", "s", "=", "(", "Statement", ")", "it", ".", "next", "(", ")", ";", "s", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "indent", "--", ";", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BlockComment", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"/*", "*/\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BooleanLiteral", "node", ")", "{", "if", "(", "node", ".", "booleanValue", "(", ")", "==", "true", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"true\"", ")", ";", "}", "else", "{", "this", ".", "buffer", ".", "append", "(", "\"false\"", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "BreakStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"break\"", ")", ";", "if", "(", "node", ".", "getLabel", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getLabel", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CastExpression", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CatchClause", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"catch", "(\"", ")", ";", "node", ".", "getException", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CharacterLiteral", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getEscapedValue", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ClassInstanceCreation", "node", ")", "{", "if", "(", "node", ".", "getExpression", "(", ")", "!=", "null", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"new", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "getName", "(", "node", ")", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "if", "(", "node", ".", "getAnonymousClassDeclaration", "(", ")", "!=", "null", ")", "{", "node", ".", "getAnonymousClassDeclaration", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "CompilationUnit", "node", ")", "{", "if", "(", "node", ".", "getPackage", "(", ")", "!=", "null", ")", "{", "node", ".", "getPackage", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "for", "(", "Iterator", "it", "=", "node", ".", "imports", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "ImportDeclaration", "d", "=", "(", "ImportDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "}", "for", "(", "Iterator", "it", "=", "node", ".", "types", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "AbstractTypeDeclaration", "d", "=", "(", "AbstractTypeDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConditionalExpression", "node", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "?", "\"", ")", ";", "node", ".", "getThenExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", ":", "\"", ")", ";", "node", ".", "getElseExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConstructorInvocation", "node", ")", "{", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"this(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\");n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ContinueStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"continue\"", ")", ";", "if", "(", "node", ".", "getLabel", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getLabel", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "DoStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"do", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "while", "(\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\");n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EmptyStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnhancedForStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"for", "(\"", ")", ";", "node", ".", "getParameter", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", ":", "\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumConstantDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "!", "node", ".", "arguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "}", "if", "(", "node", ".", "getAnonymousClassDeclaration", "(", ")", "!=", "null", ")", "{", "node", ".", "getAnonymousClassDeclaration", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"enum", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "if", "(", "!", "node", ".", "superInterfaceTypes", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"implements", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "superInterfaceTypes", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"{\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "enumConstants", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "EnumConstantDeclaration", "d", "=", "(", "EnumConstantDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "if", "(", "!", "node", ".", "bodyDeclarations", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\";", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "bodyDeclarations", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "d", "=", "(", "BodyDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ExpressionStatement", "node", ")", "{", "printIndent", "(", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldAccess", "node", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "fragments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "VariableDeclarationFragment", "f", "=", "(", "VariableDeclarationFragment", ")", "it", ".", "next", "(", ")", ";", "f", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ForStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"for", "(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "initializers", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";", "\"", ")", ";", "if", "(", "node", ".", "getExpression", "(", ")", "!=", "null", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "updaters", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "IfStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"if", "(\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getThenStatement", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getElseStatement", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "else", "\"", ")", ";", "node", ".", "getElseStatement", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ImportDeclaration", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"import", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "node", ".", "isStatic", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"static", "\"", ")", ";", "}", "}", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "isOnDemand", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\".*\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InfixExpression", "node", ")", "{", "node", ".", "getLeftOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "'", "'", ")", ";", "this", ".", "buffer", ".", "append", "(", "node", ".", "getOperator", "(", ")", ".", "toString", "(", ")", ")", ";", "this", ".", "buffer", ".", "append", "(", "'", "'", ")", ";", "node", ".", "getRightOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "final", "List", "extendedOperands", "=", "node", ".", "extendedOperands", "(", ")", ";", "if", "(", "extendedOperands", ".", "size", "(", ")", "!=", "0", ")", "{", "this", ".", "buffer", ".", "append", "(", "'", "'", ")", ";", "for", "(", "Iterator", "it", "=", "extendedOperands", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getOperator", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Initializer", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "InstanceofExpression", "node", ")", "{", "node", ".", "getLeftOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "instanceof", "\"", ")", ";", "node", ".", "getRightOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Javadoc", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"/**", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "tags", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "e", "=", "(", "ASTNode", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"n", "*/n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "LabeledStatement", "node", ")", "{", "printIndent", "(", ")", ";", "node", ".", "getLabel", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\":", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "LineComment", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"//n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MarkerAnnotation", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"@\"", ")", ";", "node", ".", "getTypeName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberRef", "node", ")", "{", "if", "(", "node", ".", "getQualifier", "(", ")", "!=", "null", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"#\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MemberValuePair", "node", ")", "{", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"=\"", ")", ";", "node", ".", "getValue", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "if", "(", "!", "node", ".", "typeParameters", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeParameters", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "TypeParameter", "t", "=", "(", "TypeParameter", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "if", "(", "!", "node", ".", "isConstructor", "(", ")", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "getReturnType", "(", "node", ")", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "if", "(", "node", ".", "getReturnType2", "(", ")", "!=", "null", ")", "{", "node", ".", "getReturnType2", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "else", "{", "this", ".", "buffer", ".", "append", "(", "\"void\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "parameters", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "SingleVariableDeclaration", "v", "=", "(", "SingleVariableDeclaration", ")", "it", ".", "next", "(", ")", ";", "v", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getExtraDimensions", "(", ")", ";", "i", "++", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"[]\"", ")", ";", "}", "if", "(", "!", "node", ".", "thrownExceptions", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "throws", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "thrownExceptions", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Name", "n", "=", "(", "Name", ")", "it", ".", "next", "(", ")", ";", "n", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "if", "(", "node", ".", "getBody", "(", ")", "==", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "}", "else", "{", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodInvocation", "node", ")", "{", "if", "(", "node", ".", "getExpression", "(", ")", "!=", "null", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRef", "node", ")", "{", "if", "(", "node", ".", "getQualifier", "(", ")", "!=", "null", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"#\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "parameters", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "MethodRefParameter", "e", "=", "(", "MethodRefParameter", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodRefParameter", "node", ")", "{", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "node", ".", "isVarargs", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"...\"", ")", ";", "}", "}", "if", "(", "node", ".", "getName", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Modifier", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getKeyword", "(", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NormalAnnotation", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"@\"", ")", ";", "node", ".", "getTypeName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "MemberValuePair", "p", "=", "(", "MemberValuePair", ")", "it", ".", "next", "(", ")", ";", "p", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NullLiteral", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"null\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "NumberLiteral", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getToken", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PackageDeclaration", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "for", "(", "Iterator", "it", "=", "node", ".", "annotations", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Annotation", "p", "=", "(", "Annotation", ")", "it", ".", "next", "(", ")", ";", "p", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "}", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"package", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParameterizedType", "node", ")", "{", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ParenthesizedExpression", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PostfixExpression", "node", ")", "{", "node", ".", "getOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "node", ".", "getOperator", "(", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrefixExpression", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getOperator", "(", ")", ".", "toString", "(", ")", ")", ";", "node", ".", "getOperand", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "PrimitiveType", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getPrimitiveTypeCode", "(", ")", ".", "toString", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedName", "node", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedType", "node", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ReturnStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"return\"", ")", ";", "if", "(", "node", ".", "getExpression", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleName", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getIdentifier", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SimpleType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SingleMemberAnnotation", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"@\"", ")", ";", "node", ".", "getTypeName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "node", ".", "getValue", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleVariableDeclaration", "node", ")", "{", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "node", ".", "isVarargs", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"...\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getExtraDimensions", "(", ")", ";", "i", "++", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"[]\"", ")", ";", "}", "if", "(", "node", ".", "getInitializer", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"=\"", ")", ";", "node", ".", "getInitializer", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "StringLiteral", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getEscapedValue", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperConstructorInvocation", "node", ")", "{", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getExpression", "(", ")", "!=", "null", ")", "{", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"super(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\");n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperFieldAccess", "node", ")", "{", "if", "(", "node", ".", "getQualifier", "(", ")", "!=", "null", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"super.\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SuperMethodInvocation", "node", ")", "{", "if", "(", "node", ".", "getQualifier", "(", ")", "!=", "null", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"super.\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeArguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "arguments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Expression", "e", "=", "(", "Expression", ")", "it", ".", "next", "(", ")", ";", "e", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SwitchCase", "node", ")", "{", "if", "(", "node", ".", "isDefault", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"default", ":n\"", ")", ";", "}", "else", "{", "this", ".", "buffer", ".", "append", "(", "\"case", "\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\":n\"", ")", ";", "}", "this", ".", "indent", "++", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SwitchStatement", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"switch", "(\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"{n\"", ")", ";", "this", ".", "indent", "++", ";", "for", "(", "Iterator", "it", "=", "node", ".", "statements", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Statement", "s", "=", "(", "Statement", ")", "it", ".", "next", "(", ")", ";", "s", ".", "accept", "(", "this", ")", ";", "this", ".", "indent", "--", ";", "}", "this", ".", "indent", "--", ";", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SynchronizedStatement", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TagElement", "node", ")", "{", "if", "(", "node", ".", "isNested", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"{\"", ")", ";", "}", "else", "{", "this", ".", "buffer", ".", "append", "(", "\"n", "*", "\"", ")", ";", "}", "boolean", "previousRequiresWhiteSpace", "=", "false", ";", "if", "(", "node", ".", "getTagName", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getTagName", "(", ")", ")", ";", "previousRequiresWhiteSpace", "=", "true", ";", "}", "boolean", "previousRequiresNewLine", "=", "false", ";", "for", "(", "Iterator", "it", "=", "node", ".", "fragments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "e", "=", "(", "ASTNode", ")", "it", ".", "next", "(", ")", ";", "boolean", "currentIncludesWhiteSpace", "=", "(", "e", "instanceof", "TextElement", ")", ";", "if", "(", "previousRequiresNewLine", "&&", "currentIncludesWhiteSpace", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"n", "*", "\"", ")", ";", "}", "previousRequiresNewLine", "=", "currentIncludesWhiteSpace", ";", "if", "(", "previousRequiresWhiteSpace", "&&", "!", "currentIncludesWhiteSpace", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "e", ".", "accept", "(", "this", ")", ";", "previousRequiresWhiteSpace", "=", "!", "currentIncludesWhiteSpace", "&&", "!", "(", "e", "instanceof", "TagElement", ")", ";", "}", "if", "(", "node", ".", "isNested", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TextElement", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "getText", "(", ")", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThisExpression", "node", ")", "{", "if", "(", "node", ".", "getQualifier", "(", ")", "!=", "null", ")", "{", "node", ".", "getQualifier", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "\"this\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ThrowStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"throw", "\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TryStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"try", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "AST", ".", "JLS4", ")", "{", "List", "resources", "=", "node", ".", "resources", "(", ")", ";", "if", "(", "!", "resources", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "'('", ")", ";", "for", "(", "Iterator", "it", "=", "resources", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "VariableDeclarationExpression", "variable", "=", "(", "VariableDeclarationExpression", ")", "it", ".", "next", "(", ")", ";", "variable", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "';'", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "')'", ")", ";", "}", "}", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "catchClauses", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "CatchClause", "cc", "=", "(", "CatchClause", ")", "it", ".", "next", "(", ")", ";", "cc", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getFinally", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "finally", "\"", ")", ";", "node", ".", "getFinally", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "node", ")", "{", "if", "(", "node", ".", "getJavadoc", "(", ")", "!=", "null", ")", "{", "node", ".", "getJavadoc", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "this", ".", "buffer", ".", "append", "(", "node", ".", "isInterface", "(", ")", "?", "\"interface", "\"", ":", "\"class", "\"", ")", ";", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "!", "node", ".", "typeParameters", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"<\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeParameters", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "TypeParameter", "t", "=", "(", "TypeParameter", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "if", "(", "getSuperclass", "(", "node", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"extends", "\"", ")", ";", "getSuperclass", "(", "node", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "if", "(", "!", "superInterfaces", "(", "node", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "isInterface", "(", ")", "?", "\"extends", "\"", ":", "\"implements", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "superInterfaces", "(", "node", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Name", "n", "=", "(", "Name", ")", "it", ".", "next", "(", ")", ";", "n", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "if", "(", "node", ".", "getSuperclassType", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"extends", "\"", ")", ";", "node", ".", "getSuperclassType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "if", "(", "!", "node", ".", "superInterfaceTypes", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "node", ".", "isInterface", "(", ")", "?", "\"extends", "\"", ":", "\"implements", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "superInterfaceTypes", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\"{n\"", ")", ";", "this", ".", "indent", "++", ";", "for", "(", "Iterator", "it", "=", "node", ".", "bodyDeclarations", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "d", "=", "(", "BodyDeclaration", ")", "it", ".", "next", "(", ")", ";", "d", ".", "accept", "(", "this", ")", ";", "}", "this", ".", "indent", "--", ";", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"}n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclarationStatement", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "getTypeDeclaration", "(", "node", ")", ".", "accept", "(", "this", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "node", ".", "getDeclaration", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeLiteral", "node", ")", "{", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\".class\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeParameter", "node", ")", "{", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "if", "(", "!", "node", ".", "typeBounds", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "extends", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "typeBounds", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "&", "\"", ")", ";", "}", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "UnionType", "node", ")", "{", "for", "(", "Iterator", "it", "=", "node", ".", "types", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Type", "t", "=", "(", "Type", ")", "it", ".", "next", "(", ")", ";", "t", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "'|'", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationExpression", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "fragments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "VariableDeclarationFragment", "f", "=", "(", "VariableDeclarationFragment", ")", "it", ".", "next", "(", ")", ";", "f", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationFragment", "node", ")", "{", "node", ".", "getName", "(", ")", ".", "accept", "(", "this", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getExtraDimensions", "(", ")", ";", "i", "++", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"[]\"", ")", ";", "}", "if", "(", "node", ".", "getInitializer", "(", ")", "!=", "null", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"=\"", ")", ";", "node", ".", "getInitializer", "(", ")", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationStatement", "node", ")", "{", "printIndent", "(", ")", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "JLS2", ")", "{", "printModifiers", "(", "node", ".", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", "(", ")", ">=", "JLS3", ")", "{", "printModifiers", "(", "node", ".", "modifiers", "(", ")", ")", ";", "}", "node", ".", "getType", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "for", "(", "Iterator", "it", "=", "node", ".", "fragments", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "VariableDeclarationFragment", "f", "=", "(", "VariableDeclarationFragment", ")", "it", ".", "next", "(", ")", ";", "f", ".", "accept", "(", "this", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "this", ".", "buffer", ".", "append", "(", "\";n\"", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WhileStatement", "node", ")", "{", "printIndent", "(", ")", ";", "this", ".", "buffer", ".", "append", "(", "\"while", "(\"", ")", ";", "node", ".", "getExpression", "(", ")", ".", "accept", "(", "this", ")", ";", "this", ".", "buffer", ".", "append", "(", "\")", "\"", ")", ";", "node", ".", "getBody", "(", ")", ".", "accept", "(", "this", ")", ";", "return", "false", ";", "}", "public", "boolean", "visit", "(", "WildcardType", "node", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"?\"", ")", ";", "Type", "bound", "=", "node", ".", "getBound", "(", ")", ";", "if", "(", "bound", "!=", "null", ")", "{", "if", "(", "node", ".", "isUpperBound", "(", ")", ")", "{", "this", ".", "buffer", ".", "append", "(", "\"", "extends", "\"", ")", ";", "}", "else", "{", "this", ".", "buffer", ".", "append", "(", "\"", "super", "\"", ")", ";", "}", "bound", ".", "accept", "(", "this", ")", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
2,329
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ForStatement", "extends", "Statement", "{", "public", "static", "final", "ChildListPropertyDescriptor", "INITIALIZERS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "ForStatement", ".", "class", ",", "\"initializers\"", ",", "Expression", ".", "class", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ForStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "UPDATERS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "ForStatement", ".", "class", ",", "\"updaters\"", ",", "Expression", ".", "class", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "BODY_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ForStatement", ".", "class", ",", "\"body\"", ",", "Statement", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "5", ")", ";", "createPropertyList", "(", "ForStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "INITIALIZERS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "UPDATERS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ASTNode", ".", "NodeList", "initializers", "=", "new", "ASTNode", ".", "NodeList", "(", "INITIALIZERS_PROPERTY", ")", ";", "private", "Expression", "optionalConditionExpression", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "updaters", "=", "new", "ASTNode", ".", "NodeList", "(", "UPDATERS_PROPERTY", ")", ";", "private", "Statement", "body", "=", "null", ";", "ForStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "BODY_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getBody", "(", ")", ";", "}", "else", "{", "setBody", "(", "(", "Statement", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "INITIALIZERS_PROPERTY", ")", "{", "return", "initializers", "(", ")", ";", "}", "if", "(", "property", "==", "UPDATERS_PROPERTY", ")", "{", "return", "updaters", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "FOR_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ForStatement", "result", "=", "new", "ForStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "initializers", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "initializers", "(", ")", ")", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getExpression", "(", ")", ")", ")", ";", "result", ".", "updaters", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "updaters", "(", ")", ")", ")", ";", "result", ".", "setBody", "(", "(", "Statement", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getBody", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "initializers", ")", ";", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "updaters", ")", ";", "acceptChild", "(", "visitor", ",", "getBody", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "List", "initializers", "(", ")", "{", "return", "this", ".", "initializers", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "return", "this", ".", "optionalConditionExpression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalConditionExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "optionalConditionExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "List", "updaters", "(", ")", "{", "return", "this", ".", "updaters", ";", "}", "public", "Statement", "getBody", "(", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "body", "=", "new", "Block", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "body", ",", "BODY_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "body", ";", "}", "public", "void", "setBody", "(", "Statement", "statement", ")", "{", "if", "(", "statement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "body", ";", "preReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "this", ".", "body", "=", "statement", ";", "postReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "4", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "this", ".", "initializers", ".", "listSize", "(", ")", "+", "this", ".", "updaters", ".", "listSize", "(", ")", "+", "(", "this", ".", "optionalConditionExpression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "body", "==", "null", "?", "0", ":", "getBody", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,330
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BindingResolver", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "IMethodBinding", ";", "class", "DefaultValuePairBinding", "extends", "MemberValuePairBinding", "{", "private", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", "method", ";", "DefaultValuePairBinding", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", "binding", ",", "BindingResolver", "resolver", ")", "{", "super", "(", "null", ",", "resolver", ")", ";", "this", ".", "method", "=", "binding", ";", "this", ".", "value", "=", "MemberValuePairBinding", ".", "buildDOMValue", "(", "binding", ".", "getDefaultValue", "(", ")", ",", "resolver", ")", ";", "if", "(", "binding", ".", "returnType", "!=", "null", "&&", "binding", ".", "returnType", ".", "isArrayType", "(", ")", ")", "{", "if", "(", "!", "this", ".", "value", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "this", ".", "value", "=", "new", "Object", "[", "]", "{", "this", ".", "value", "}", ";", "}", "}", "}", "public", "IMethodBinding", "getMethodBinding", "(", ")", "{", "return", "this", ".", "bindingResolver", ".", "getMethodBinding", "(", "this", ".", "method", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "new", "String", "(", "this", ".", "method", ".", "selector", ")", ";", "}", "public", "Object", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "boolean", "isDefault", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "return", "this", ".", "method", ".", "isDeprecated", "(", ")", ";", "}", "}", "</s>" ]
2,331
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "Assignment", "extends", "Expression", "{", "public", "static", "class", "Operator", "{", "private", "String", "op", ";", "private", "Operator", "(", "String", "op", ")", "{", "this", ".", "op", "=", "op", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "op", ";", "}", "public", "static", "final", "Operator", "ASSIGN", "=", "new", "Operator", "(", "\"=\"", ")", ";", "public", "static", "final", "Operator", "PLUS_ASSIGN", "=", "new", "Operator", "(", "\"+=\"", ")", ";", "public", "static", "final", "Operator", "MINUS_ASSIGN", "=", "new", "Operator", "(", "\"-=\"", ")", ";", "public", "static", "final", "Operator", "TIMES_ASSIGN", "=", "new", "Operator", "(", "\"*=\"", ")", ";", "public", "static", "final", "Operator", "DIVIDE_ASSIGN", "=", "new", "Operator", "(", "\"/=\"", ")", ";", "public", "static", "final", "Operator", "BIT_AND_ASSIGN", "=", "new", "Operator", "(", "\"&=\"", ")", ";", "public", "static", "final", "Operator", "BIT_OR_ASSIGN", "=", "new", "Operator", "(", "\"|=\"", ")", ";", "public", "static", "final", "Operator", "BIT_XOR_ASSIGN", "=", "new", "Operator", "(", "\"^=\"", ")", ";", "public", "static", "final", "Operator", "REMAINDER_ASSIGN", "=", "new", "Operator", "(", "\"%=\"", ")", ";", "public", "static", "final", "Operator", "LEFT_SHIFT_ASSIGN", "=", "new", "Operator", "(", "\"<<=\"", ")", ";", "public", "static", "final", "Operator", "RIGHT_SHIFT_SIGNED_ASSIGN", "=", "new", "Operator", "(", "\">>=\"", ")", ";", "public", "static", "final", "Operator", "RIGHT_SHIFT_UNSIGNED_ASSIGN", "=", "new", "Operator", "(", "\">>>=\"", ")", ";", "public", "static", "Operator", "toOperator", "(", "String", "token", ")", "{", "return", "(", "Operator", ")", "CODES", ".", "get", "(", "token", ")", ";", "}", "private", "static", "final", "Map", "CODES", ";", "static", "{", "CODES", "=", "new", "HashMap", "(", "20", ")", ";", "Operator", "[", "]", "ops", "=", "{", "ASSIGN", ",", "PLUS_ASSIGN", ",", "MINUS_ASSIGN", ",", "TIMES_ASSIGN", ",", "DIVIDE_ASSIGN", ",", "BIT_AND_ASSIGN", ",", "BIT_OR_ASSIGN", ",", "BIT_XOR_ASSIGN", ",", "REMAINDER_ASSIGN", ",", "LEFT_SHIFT_ASSIGN", ",", "RIGHT_SHIFT_SIGNED_ASSIGN", ",", "RIGHT_SHIFT_UNSIGNED_ASSIGN", "}", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ops", ".", "length", ";", "i", "++", ")", "{", "CODES", ".", "put", "(", "ops", "[", "i", "]", ".", "toString", "(", ")", ",", "ops", "[", "i", "]", ")", ";", "}", "}", "}", "public", "static", "final", "ChildPropertyDescriptor", "LEFT_HAND_SIDE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "Assignment", ".", "class", ",", "\"leftHandSide\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "OPERATOR_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "Assignment", ".", "class", ",", "\"operator\"", ",", "Assignment", ".", "Operator", ".", "class", ",", "MANDATORY", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "RIGHT_HAND_SIDE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "Assignment", ".", "class", ",", "\"\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "Assignment", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "LEFT_HAND_SIDE_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "OPERATOR_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "RIGHT_HAND_SIDE_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Assignment", ".", "Operator", "assignmentOperator", "=", "Assignment", ".", "Operator", ".", "ASSIGN", ";", "private", "Expression", "leftHandSide", "=", "null", ";", "private", "Expression", "rightHandSide", "=", "null", ";", "Assignment", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "Object", "internalGetSetObjectProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "Object", "value", ")", "{", "if", "(", "property", "==", "OPERATOR_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getOperator", "(", ")", ";", "}", "else", "{", "setOperator", "(", "(", "Operator", ")", "value", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetObjectProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "LEFT_HAND_SIDE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getLeftHandSide", "(", ")", ";", "}", "else", "{", "setLeftHandSide", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "RIGHT_HAND_SIDE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getRightHandSide", "(", ")", ";", "}", "else", "{", "setRightHandSide", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ASSIGNMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "Assignment", "result", "=", "new", "Assignment", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setOperator", "(", "getOperator", "(", ")", ")", ";", "result", ".", "setLeftHandSide", "(", "(", "Expression", ")", "getLeftHandSide", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setRightHandSide", "(", "(", "Expression", ")", "getRightHandSide", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getLeftHandSide", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getRightHandSide", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Assignment", ".", "Operator", "getOperator", "(", ")", "{", "return", "this", ".", "assignmentOperator", ";", "}", "public", "void", "setOperator", "(", "Assignment", ".", "Operator", "assignmentOperator", ")", "{", "if", "(", "assignmentOperator", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "preValueChange", "(", "OPERATOR_PROPERTY", ")", ";", "this", ".", "assignmentOperator", "=", "assignmentOperator", ";", "postValueChange", "(", "OPERATOR_PROPERTY", ")", ";", "}", "public", "Expression", "getLeftHandSide", "(", ")", "{", "if", "(", "this", ".", "leftHandSide", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "leftHandSide", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "leftHandSide", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "leftHandSide", ",", "LEFT_HAND_SIDE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "leftHandSide", ";", "}", "public", "void", "setLeftHandSide", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "leftHandSide", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "LEFT_HAND_SIDE_PROPERTY", ")", ";", "this", ".", "leftHandSide", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "LEFT_HAND_SIDE_PROPERTY", ")", ";", "}", "public", "Expression", "getRightHandSide", "(", ")", "{", "if", "(", "this", ".", "rightHandSide", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "rightHandSide", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "rightHandSide", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "rightHandSide", ",", "RIGHT_HAND_SIDE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "rightHandSide", ";", "}", "public", "void", "setRightHandSide", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "rightHandSide", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "RIGHT_HAND_SIDE_PROPERTY", ")", ";", "this", ".", "rightHandSide", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "RIGHT_HAND_SIDE_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "leftHandSide", "==", "null", "?", "0", ":", "getLeftHandSide", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "rightHandSide", "==", "null", "?", "0", ":", "getRightHandSide", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,332
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "InstanceofExpression", "extends", "Expression", "{", "public", "static", "final", "ChildPropertyDescriptor", "LEFT_OPERAND_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "InstanceofExpression", ".", "class", ",", "\"leftOperand\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "RIGHT_OPERAND_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "InstanceofExpression", ".", "class", ",", "\"rightOperand\"", ",", "Type", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "InstanceofExpression", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "LEFT_OPERAND_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "RIGHT_OPERAND_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "leftOperand", "=", "null", ";", "private", "Type", "rightOperand", "=", "null", ";", "InstanceofExpression", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "LEFT_OPERAND_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getLeftOperand", "(", ")", ";", "}", "else", "{", "setLeftOperand", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "RIGHT_OPERAND_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getRightOperand", "(", ")", ";", "}", "else", "{", "setRightOperand", "(", "(", "Type", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "INSTANCEOF_EXPRESSION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "InstanceofExpression", "result", "=", "new", "InstanceofExpression", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setLeftOperand", "(", "(", "Expression", ")", "getLeftOperand", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setRightOperand", "(", "(", "Type", ")", "getRightOperand", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getLeftOperand", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getRightOperand", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getLeftOperand", "(", ")", "{", "if", "(", "this", ".", "leftOperand", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "leftOperand", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "leftOperand", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "leftOperand", ",", "LEFT_OPERAND_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "leftOperand", ";", "}", "public", "void", "setLeftOperand", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "leftOperand", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "LEFT_OPERAND_PROPERTY", ")", ";", "this", ".", "leftOperand", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "LEFT_OPERAND_PROPERTY", ")", ";", "}", "public", "Type", "getRightOperand", "(", ")", "{", "if", "(", "this", ".", "rightOperand", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "rightOperand", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "rightOperand", "=", "new", "SimpleType", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "rightOperand", ",", "RIGHT_OPERAND_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "rightOperand", ";", "}", "public", "void", "setRightOperand", "(", "Type", "referenceType", ")", "{", "if", "(", "referenceType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "rightOperand", ";", "preReplaceChild", "(", "oldChild", ",", "referenceType", ",", "RIGHT_OPERAND_PROPERTY", ")", ";", "this", ".", "rightOperand", "=", "referenceType", ";", "postReplaceChild", "(", "oldChild", ",", "referenceType", ",", "RIGHT_OPERAND_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "leftOperand", "==", "null", "?", "0", ":", "getLeftOperand", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "rightOperand", "==", "null", "?", "0", ":", "getRightOperand", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,333
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "batch", ".", "FileSystem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "NameEnvironmentAnswer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "INameEnvironmentWithProgress", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "NameLookup", ";", "class", "NameEnvironmentWithProgress", "extends", "FileSystem", "implements", "INameEnvironmentWithProgress", "{", "IProgressMonitor", "monitor", ";", "public", "NameEnvironmentWithProgress", "(", "Classpath", "[", "]", "paths", ",", "String", "[", "]", "initialFileNames", ",", "IProgressMonitor", "monitor", ")", "{", "super", "(", "paths", ",", "initialFileNames", ")", ";", "setMonitor", "(", "monitor", ")", ";", "}", "private", "void", "checkCanceled", "(", ")", "{", "if", "(", "this", ".", "monitor", "!=", "null", "&&", "this", ".", "monitor", ".", "isCanceled", "(", ")", ")", "{", "if", "(", "NameLookup", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", ")", ";", "}", "throw", "new", "AbortCompilation", "(", "true", ",", "new", "OperationCanceledException", "(", ")", ")", ";", "}", "}", "public", "NameEnvironmentAnswer", "findType", "(", "char", "[", "]", "typeName", ",", "char", "[", "]", "[", "]", "packageName", ")", "{", "checkCanceled", "(", ")", ";", "return", "super", ".", "findType", "(", "typeName", ",", "packageName", ")", ";", "}", "public", "NameEnvironmentAnswer", "findType", "(", "char", "[", "]", "[", "]", "compoundName", ")", "{", "checkCanceled", "(", ")", ";", "return", "super", ".", "findType", "(", "compoundName", ")", ";", "}", "public", "boolean", "isPackage", "(", "char", "[", "]", "[", "]", "compoundName", ",", "char", "[", "]", "packageName", ")", "{", "checkCanceled", "(", ")", ";", "return", "super", ".", "isPackage", "(", "compoundName", ",", "packageName", ")", ";", "}", "public", "void", "setMonitor", "(", "IProgressMonitor", "monitor", ")", "{", "this", ".", "monitor", "=", "monitor", ";", "}", "}", "</s>" ]
2,334
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "StructuralPropertyDescriptor", "{", "private", "final", "String", "propertyId", ";", "private", "final", "Class", "nodeClass", ";", "StructuralPropertyDescriptor", "(", "Class", "nodeClass", ",", "String", "propertyId", ")", "{", "if", "(", "nodeClass", "==", "null", "||", "propertyId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "propertyId", "=", "propertyId", ";", "this", ".", "nodeClass", "=", "nodeClass", ";", "}", "public", "final", "String", "getId", "(", ")", "{", "return", "this", ".", "propertyId", ";", "}", "public", "final", "Class", "getNodeClass", "(", ")", "{", "return", "this", ".", "nodeClass", ";", "}", "public", "final", "boolean", "isSimpleProperty", "(", ")", "{", "return", "(", "this", "instanceof", "SimplePropertyDescriptor", ")", ";", "}", "public", "final", "boolean", "isChildProperty", "(", ")", "{", "return", "(", "this", "instanceof", "ChildPropertyDescriptor", ")", ";", "}", "public", "final", "boolean", "isChildListProperty", "(", ")", "{", "return", "(", "this", "instanceof", "ChildListPropertyDescriptor", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "b", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "isChildListProperty", "(", ")", ")", "{", "b", ".", "append", "(", "\"ChildList\"", ")", ";", "}", "if", "(", "isChildProperty", "(", ")", ")", "{", "b", ".", "append", "(", "\"Child\"", ")", ";", "}", "if", "(", "isSimpleProperty", "(", ")", ")", "{", "b", ".", "append", "(", "\"Simple\"", ")", ";", "}", "b", ".", "append", "(", "\"Property[\"", ")", ";", "if", "(", "this", ".", "nodeClass", "!=", "null", ")", "{", "b", ".", "append", "(", "this", ".", "nodeClass", ".", "getName", "(", ")", ")", ";", "}", "b", ".", "append", "(", "\",\"", ")", ";", "if", "(", "this", ".", "propertyId", "!=", "null", ")", "{", "b", ".", "append", "(", "this", ".", "propertyId", ")", ";", "}", "b", ".", "append", "(", "\"]\"", ")", ";", "return", "b", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,335
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ArrayCreation", "extends", "Expression", "{", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ArrayCreation", ".", "class", ",", "\"type\"", ",", "ArrayType", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "DIMENSIONS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "ArrayCreation", ".", "class", ",", "\"dimensions\"", ",", "Expression", ".", "class", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "INITIALIZER_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ArrayCreation", ".", "class", ",", "\"initializer\"", ",", "ArrayInitializer", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "ArrayCreation", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "TYPE_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "DIMENSIONS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "INITIALIZER_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ArrayType", "arrayType", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "dimensions", "=", "new", "ASTNode", ".", "NodeList", "(", "DIMENSIONS_PROPERTY", ")", ";", "private", "ArrayInitializer", "optionalInitializer", "=", "null", ";", "ArrayCreation", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "INITIALIZER_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getInitializer", "(", ")", ";", "}", "else", "{", "setInitializer", "(", "(", "ArrayInitializer", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "TYPE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getType", "(", ")", ";", "}", "else", "{", "setType", "(", "(", "ArrayType", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "DIMENSIONS_PROPERTY", ")", "{", "return", "dimensions", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ARRAY_CREATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ArrayCreation", "result", "=", "new", "ArrayCreation", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setType", "(", "(", "ArrayType", ")", "getType", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "dimensions", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "dimensions", "(", ")", ")", ")", ";", "result", ".", "setInitializer", "(", "(", "ArrayInitializer", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getInitializer", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getType", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "dimensions", ")", ";", "acceptChild", "(", "visitor", ",", "getInitializer", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "ArrayType", "getType", "(", ")", "{", "if", "(", "this", ".", "arrayType", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "arrayType", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "arrayType", "=", "this", ".", "ast", ".", "newArrayType", "(", "this", ".", "ast", ".", "newPrimitiveType", "(", "PrimitiveType", ".", "INT", ")", ")", ";", "postLazyInit", "(", "this", ".", "arrayType", ",", "TYPE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "arrayType", ";", "}", "public", "void", "setType", "(", "ArrayType", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "arrayType", ";", "preReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "this", ".", "arrayType", "=", "type", ";", "postReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "}", "public", "List", "dimensions", "(", ")", "{", "return", "this", ".", "dimensions", ";", "}", "public", "ArrayInitializer", "getInitializer", "(", ")", "{", "return", "this", ".", "optionalInitializer", ";", "}", "public", "void", "setInitializer", "(", "ArrayInitializer", "initializer", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalInitializer", ";", "preReplaceChild", "(", "oldChild", ",", "initializer", ",", "INITIALIZER_PROPERTY", ")", ";", "this", ".", "optionalInitializer", "=", "initializer", ";", "postReplaceChild", "(", "oldChild", ",", "initializer", ",", "INITIALIZER_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "int", "size", "=", "memSize", "(", ")", "+", "(", "this", ".", "arrayType", "==", "null", "?", "0", ":", "getType", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalInitializer", "==", "null", "?", "0", ":", "getInitializer", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "dimensions", ".", "listSize", "(", ")", ";", "return", "size", ";", "}", "}", "</s>" ]
2,336
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "Expression", "extends", "ASTNode", "{", "Expression", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "public", "final", "Object", "resolveConstantExpressionValue", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveConstantExpressionValue", "(", "this", ")", ";", "}", "public", "final", "ITypeBinding", "resolveTypeBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveExpressionType", "(", "this", ")", ";", "}", "public", "final", "boolean", "resolveBoxing", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveBoxing", "(", "this", ")", ";", "}", "public", "final", "boolean", "resolveUnboxing", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveUnboxing", "(", "this", ")", ";", "}", "}", "</s>" ]
2,337
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "interface", "IMethodBinding", "extends", "IBinding", "{", "public", "boolean", "isConstructor", "(", ")", ";", "public", "boolean", "isDefaultConstructor", "(", ")", ";", "public", "String", "getName", "(", ")", ";", "public", "ITypeBinding", "getDeclaringClass", "(", ")", ";", "public", "Object", "getDefaultValue", "(", ")", ";", "public", "IAnnotationBinding", "[", "]", "getParameterAnnotations", "(", "int", "paramIndex", ")", ";", "public", "ITypeBinding", "[", "]", "getParameterTypes", "(", ")", ";", "public", "ITypeBinding", "getReturnType", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getExceptionTypes", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getTypeParameters", "(", ")", ";", "public", "boolean", "isAnnotationMember", "(", ")", ";", "public", "boolean", "isGenericMethod", "(", ")", ";", "public", "boolean", "isParameterizedMethod", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getTypeArguments", "(", ")", ";", "public", "IMethodBinding", "getMethodDeclaration", "(", ")", ";", "public", "boolean", "isRawMethod", "(", ")", ";", "public", "boolean", "isSubsignature", "(", "IMethodBinding", "otherMethod", ")", ";", "public", "boolean", "isVarargs", "(", ")", ";", "public", "boolean", "overrides", "(", "IMethodBinding", "method", ")", ";", "}", "</s>" ]
2,338
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "EnumDeclaration", "extends", "AbstractTypeDeclaration", "{", "public", "static", "final", "ChildPropertyDescriptor", "JAVADOC_PROPERTY", "=", "internalJavadocPropertyFactory", "(", "EnumDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "MODIFIERS2_PROPERTY", "=", "internalModifiers2PropertyFactory", "(", "EnumDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "internalNamePropertyFactory", "(", "EnumDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "SUPER_INTERFACE_TYPES_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "EnumDeclaration", ".", "class", ",", "\"\"", ",", "Type", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "ENUM_CONSTANTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "EnumDeclaration", ".", "class", ",", "\"\"", ",", "EnumConstantDeclaration", ".", "class", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "BODY_DECLARATIONS_PROPERTY", "=", "internalBodyDeclarationPropertyFactory", "(", "EnumDeclaration", ".", "class", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "6", ")", ";", "createPropertyList", "(", "EnumDeclaration", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "MODIFIERS2_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "SUPER_INTERFACE_TYPES_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ENUM_CONSTANTS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_DECLARATIONS_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ASTNode", ".", "NodeList", "superInterfaceTypes", "=", "new", "ASTNode", ".", "NodeList", "(", "SUPER_INTERFACE_TYPES_PROPERTY", ")", ";", "private", "ASTNode", ".", "NodeList", "enumConstants", "=", "new", "ASTNode", ".", "NodeList", "(", "ENUM_CONSTANTS_PROPERTY", ")", ";", "EnumDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "JAVADOC_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getJavadoc", "(", ")", ";", "}", "else", "{", "setJavadoc", "(", "(", "Javadoc", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "MODIFIERS2_PROPERTY", ")", "{", "return", "modifiers", "(", ")", ";", "}", "if", "(", "property", "==", "SUPER_INTERFACE_TYPES_PROPERTY", ")", "{", "return", "superInterfaceTypes", "(", ")", ";", "}", "if", "(", "property", "==", "ENUM_CONSTANTS_PROPERTY", ")", "{", "return", "enumConstants", "(", ")", ";", "}", "if", "(", "property", "==", "BODY_DECLARATIONS_PROPERTY", ")", "{", "return", "bodyDeclarations", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalJavadocProperty", "(", ")", "{", "return", "JAVADOC_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalModifiers2Property", "(", ")", "{", "return", "MODIFIERS2_PROPERTY", ";", "}", "final", "SimplePropertyDescriptor", "internalModifiersProperty", "(", ")", "{", "return", "null", ";", "}", "final", "ChildPropertyDescriptor", "internalNameProperty", "(", ")", "{", "return", "NAME_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalBodyDeclarationsProperty", "(", ")", "{", "return", "BODY_DECLARATIONS_PROPERTY", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ENUM_DECLARATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "EnumDeclaration", "result", "=", "new", "EnumDeclaration", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setJavadoc", "(", "(", "Javadoc", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getJavadoc", "(", ")", ")", ")", ";", "result", ".", "modifiers", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "modifiers", "(", ")", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "superInterfaceTypes", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "superInterfaceTypes", "(", ")", ")", ")", ";", "result", ".", "enumConstants", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "enumConstants", "(", ")", ")", ")", ";", "result", ".", "bodyDeclarations", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "bodyDeclarations", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getJavadoc", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "modifiers", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "superInterfaceTypes", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "enumConstants", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "bodyDeclarations", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "List", "superInterfaceTypes", "(", ")", "{", "return", "this", ".", "superInterfaceTypes", ";", "}", "public", "List", "enumConstants", "(", ")", "{", "return", "this", ".", "enumConstants", ";", "}", "ITypeBinding", "internalResolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveType", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalDocComment", "==", "null", "?", "0", ":", "getJavadoc", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "modifiers", ".", "listSize", "(", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "superInterfaceTypes", ".", "listSize", "(", ")", "+", "this", ".", "enumConstants", ".", "listSize", "(", ")", "+", "this", ".", "bodyDeclarations", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,339
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "interface", "IAnnotationBinding", "extends", "IBinding", "{", "IMemberValuePairBinding", "[", "]", "getAllMemberValuePairs", "(", ")", ";", "ITypeBinding", "getAnnotationType", "(", ")", ";", "IMemberValuePairBinding", "[", "]", "getDeclaredMemberValuePairs", "(", ")", ";", "public", "String", "getName", "(", ")", ";", "}", "</s>" ]
2,340
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "Block", "extends", "Statement", "{", "public", "static", "final", "ChildListPropertyDescriptor", "STATEMENTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "Block", ".", "class", ",", "\"statements\"", ",", "Statement", ".", "class", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "Block", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "STATEMENTS_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ASTNode", ".", "NodeList", "statements", "=", "new", "ASTNode", ".", "NodeList", "(", "STATEMENTS_PROPERTY", ")", ";", "Block", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "STATEMENTS_PROPERTY", ")", "{", "return", "statements", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "BLOCK", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "Block", "result", "=", "new", "Block", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "statements", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "statements", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "statements", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "List", "statements", "(", ")", "{", "return", "this", ".", "statements", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "this", ".", "statements", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,341
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Status", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "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", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "INameEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "NameEnvironmentAnswer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "BinaryTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "NameLookup", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SearchableEnvironment", ";", "class", "PackageBinding", "implements", "IPackageBinding", "{", "private", "static", "final", "String", "[", "]", "NO_NAME_COMPONENTS", "=", "CharOperation", ".", "NO_STRINGS", ";", "private", "static", "final", "String", "UNNAMED", "=", "Util", ".", "EMPTY_STRING", ";", "private", "static", "final", "char", "PACKAGE_NAME_SEPARATOR", "=", "'.'", ";", "private", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", "binding", ";", "private", "String", "name", ";", "private", "BindingResolver", "resolver", ";", "private", "String", "[", "]", "components", ";", "PackageBinding", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", "binding", ",", "BindingResolver", "resolver", ")", "{", "this", ".", "binding", "=", "binding", ";", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "IAnnotationBinding", "[", "]", "getAnnotations", "(", ")", "{", "try", "{", "INameEnvironment", "nameEnvironment", "=", "this", ".", "binding", ".", "environment", ".", "nameEnvironment", ";", "if", "(", "!", "(", "nameEnvironment", "instanceof", "SearchableEnvironment", ")", ")", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "NameLookup", "nameLookup", "=", "(", "(", "SearchableEnvironment", ")", "nameEnvironment", ")", ".", "nameLookup", ";", "if", "(", "nameLookup", "==", "null", ")", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "final", "String", "pkgName", "=", "getName", "(", ")", ";", "IPackageFragment", "[", "]", "pkgs", "=", "nameLookup", ".", "findPackageFragments", "(", "pkgName", ",", "false", ")", ";", "if", "(", "pkgs", "==", "null", ")", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "pkgs", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "int", "fragType", "=", "pkgs", "[", "i", "]", ".", "getKind", "(", ")", ";", "switch", "(", "fragType", ")", "{", "case", "IPackageFragmentRoot", ".", "K_SOURCE", ":", "String", "unitName", "=", "\"\"", ";", "ICompilationUnit", "unit", "=", "pkgs", "[", "i", "]", ".", "getCompilationUnit", "(", "unitName", ")", ";", "if", "(", "unit", "!=", "null", "&&", "unit", ".", "exists", "(", ")", ")", "{", "ASTParser", "p", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS3_INTERNAL", ")", ";", "p", ".", "setSource", "(", "unit", ")", ";", "p", ".", "setResolveBindings", "(", "true", ")", ";", "p", ".", "setUnitName", "(", "unitName", ")", ";", "p", ".", "setFocalPosition", "(", "0", ")", ";", "p", ".", "setKind", "(", "ASTParser", ".", "K_COMPILATION_UNIT", ")", ";", "CompilationUnit", "domUnit", "=", "(", "CompilationUnit", ")", "p", ".", "createAST", "(", "null", ")", ";", "PackageDeclaration", "pkgDecl", "=", "domUnit", ".", "getPackage", "(", ")", ";", "if", "(", "pkgDecl", "!=", "null", ")", "{", "List", "annos", "=", "pkgDecl", ".", "annotations", "(", ")", ";", "if", "(", "annos", "==", "null", "||", "annos", ".", "isEmpty", "(", ")", ")", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "IAnnotationBinding", "[", "]", "result", "=", "new", "IAnnotationBinding", "[", "annos", ".", "size", "(", ")", "]", ";", "int", "index", "=", "0", ";", "for", "(", "Iterator", "it", "=", "annos", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", "index", "++", ")", "{", "result", "[", "index", "]", "=", "(", "(", "Annotation", ")", "it", ".", "next", "(", ")", ")", ".", "resolveAnnotationBinding", "(", ")", ";", "if", "(", "result", "[", "index", "]", "==", "null", ")", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "return", "result", ";", "}", "}", "break", ";", "case", "IPackageFragmentRoot", ".", "K_BINARY", ":", "NameEnvironmentAnswer", "answer", "=", "nameEnvironment", ".", "findType", "(", "TypeConstants", ".", "PACKAGE_INFO_NAME", ",", "this", ".", "binding", ".", "compoundName", ")", ";", "if", "(", "answer", "!=", "null", "&&", "answer", ".", "isBinaryType", "(", ")", ")", "{", "IBinaryType", "type", "=", "answer", ".", "getBinaryType", "(", ")", ";", "char", "[", "]", "[", "]", "[", "]", "missingTypeNames", "=", "type", ".", "getMissingTypeNames", "(", ")", ";", "IBinaryAnnotation", "[", "]", "binaryAnnotations", "=", "type", ".", "getAnnotations", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "[", "]", "binaryInstances", "=", "BinaryTypeBinding", ".", "createAnnotations", "(", "binaryAnnotations", ",", "this", ".", "binding", ".", "environment", ",", "missingTypeNames", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "[", "]", "allInstances", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", ".", "addStandardAnnotations", "(", "binaryInstances", ",", "type", ".", "getTagBits", "(", ")", ",", "this", ".", "binding", ".", "environment", ")", ";", "int", "total", "=", "allInstances", ".", "length", ";", "IAnnotationBinding", "[", "]", "domInstances", "=", "new", "AnnotationBinding", "[", "total", "]", ";", "for", "(", "int", "a", "=", "0", ";", "a", "<", "total", ";", "a", "++", ")", "{", "final", "IAnnotationBinding", "annotationInstance", "=", "this", ".", "resolver", ".", "getAnnotationInstance", "(", "allInstances", "[", "a", "]", ")", ";", "if", "(", "annotationInstance", "==", "null", ")", "{", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "domInstances", "[", "a", "]", "=", "annotationInstance", ";", "}", "return", "domInstances", ";", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "public", "String", "getName", "(", ")", "{", "if", "(", "this", ".", "name", "==", "null", ")", "{", "computeNameAndComponents", "(", ")", ";", "}", "return", "this", ".", "name", ";", "}", "public", "boolean", "isUnnamed", "(", ")", "{", "return", "getName", "(", ")", ".", "equals", "(", "UNNAMED", ")", ";", "}", "public", "String", "[", "]", "getNameComponents", "(", ")", "{", "if", "(", "this", ".", "components", "==", "null", ")", "{", "computeNameAndComponents", "(", ")", ";", "}", "return", "this", ".", "components", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "IBinding", ".", "PACKAGE", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "Modifier", ".", "NONE", ";", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isRecovered", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isSynthetic", "(", ")", "{", "return", "false", ";", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "INameEnvironment", "nameEnvironment", "=", "this", ".", "binding", ".", "environment", ".", "nameEnvironment", ";", "if", "(", "!", "(", "nameEnvironment", "instanceof", "SearchableEnvironment", ")", ")", "return", "null", ";", "NameLookup", "nameLookup", "=", "(", "(", "SearchableEnvironment", ")", "nameEnvironment", ")", ".", "nameLookup", ";", "if", "(", "nameLookup", "==", "null", ")", "return", "null", ";", "IJavaElement", "[", "]", "pkgs", "=", "nameLookup", ".", "findPackageFragments", "(", "getName", "(", ")", ",", "false", ")", ";", "if", "(", "pkgs", "==", "null", ")", "return", "null", ";", "if", "(", "pkgs", ".", "length", "==", "0", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "new", "Status", "(", "IStatus", ".", "WARNING", ",", "JavaCore", ".", "PLUGIN_ID", ",", "\"\"", "+", "getName", "(", ")", "+", "\"\"", ")", ")", ";", "return", "null", ";", "}", "return", "pkgs", "[", "0", "]", ";", "}", "public", "String", "getKey", "(", ")", "{", "return", "new", "String", "(", "this", ".", "binding", ".", "computeUniqueKey", "(", ")", ")", ";", "}", "public", "boolean", "isEqualTo", "(", "IBinding", "other", ")", "{", "if", "(", "other", "==", "this", ")", "{", "return", "true", ";", "}", "if", "(", "other", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "(", "other", "instanceof", "PackageBinding", ")", ")", "{", "return", "false", ";", "}", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", "packageBinding2", "=", "(", "(", "PackageBinding", ")", "other", ")", ".", "binding", ";", "return", "CharOperation", ".", "equals", "(", "this", ".", "binding", ".", "compoundName", ",", "packageBinding2", ".", "compoundName", ")", ";", "}", "private", "void", "computeNameAndComponents", "(", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "this", ".", "binding", ".", "compoundName", ";", "if", "(", "compoundName", "==", "CharOperation", ".", "NO_CHAR_CHAR", "||", "compoundName", "==", "null", ")", "{", "this", ".", "name", "=", "UNNAMED", ";", "this", ".", "components", "=", "NO_NAME_COMPONENTS", ";", "}", "else", "{", "int", "length", "=", "compoundName", ".", "length", ";", "this", ".", "components", "=", "new", "String", "[", "length", "]", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "{", "this", ".", "components", "[", "i", "]", "=", "new", "String", "(", "compoundName", "[", "i", "]", ")", ";", "buffer", ".", "append", "(", "compoundName", "[", "i", "]", ")", ".", "append", "(", "PACKAGE_NAME_SEPARATOR", ")", ";", "}", "this", ".", "components", "[", "length", "-", "1", "]", "=", "new", "String", "(", "compoundName", "[", "length", "-", "1", "]", ")", ";", "buffer", ".", "append", "(", "compoundName", "[", "length", "-", "1", "]", ")", ";", "this", ".", "name", "=", "buffer", ".", "toString", "(", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "binding", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,342
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "TypeParameter", "extends", "ASTNode", "{", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "TypeParameter", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "TYPE_BOUNDS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "TypeParameter", ".", "class", ",", "\"typeBounds\"", ",", "Type", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "TypeParameter", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_BOUNDS_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "typeVariableName", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "typeBounds", "=", "new", "ASTNode", ".", "NodeList", "(", "TYPE_BOUNDS_PROPERTY", ")", ";", "TypeParameter", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "TYPE_BOUNDS_PROPERTY", ")", "{", "return", "typeBounds", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "TYPE_PARAMETER", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "TypeParameter", "result", "=", "new", "TypeParameter", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "(", "(", "ASTNode", ")", "getName", "(", ")", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "typeBounds", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "typeBounds", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "typeBounds", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "typeVariableName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "typeVariableName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "typeVariableName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "typeVariableName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "typeVariableName", ";", "}", "public", "final", "ITypeBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveTypeParameter", "(", "this", ")", ";", "}", "public", "void", "setName", "(", "SimpleName", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "typeVariableName", ";", "preReplaceChild", "(", "oldChild", ",", "typeName", ",", "NAME_PROPERTY", ")", ";", "this", ".", "typeVariableName", "=", "typeName", ";", "postReplaceChild", "(", "oldChild", ",", "typeName", ",", "NAME_PROPERTY", ")", ";", "}", "public", "List", "typeBounds", "(", ")", "{", "return", "this", ".", "typeBounds", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeVariableName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "typeBounds", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,343
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "MemberValuePair", "extends", "ASTNode", "{", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "MemberValuePair", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "VALUE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "MemberValuePair", ".", "class", ",", "\"value\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "MemberValuePair", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "VALUE_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "name", "=", "null", ";", "private", "Expression", "value", "=", "null", ";", "MemberValuePair", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "VALUE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getValue", "(", ")", ";", "}", "else", "{", "setValue", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "MEMBER_VALUE_PAIR", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "MemberValuePair", "result", "=", "new", "MemberValuePair", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getName", "(", ")", ")", ")", ";", "result", ".", "setValue", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getValue", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getValue", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "name", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "name", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "name", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "name", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "name", ";", "}", "public", "final", "IMemberValuePairBinding", "resolveMemberValuePairBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveMemberValuePair", "(", "this", ")", ";", "}", "public", "void", "setName", "(", "SimpleName", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "name", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "name", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "public", "Expression", "getValue", "(", ")", "{", "if", "(", "this", ".", "value", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "value", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "value", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "value", ",", "VALUE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "value", ";", "}", "public", "void", "setValue", "(", "Expression", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "value", ";", "preReplaceChild", "(", "oldChild", ",", "value", ",", "VALUE_PROPERTY", ")", ";", "this", ".", "value", "=", "value", ";", "postReplaceChild", "(", "oldChild", ",", "value", ",", "VALUE_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "name", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "value", "==", "null", "?", "0", ":", "getValue", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,344
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "public", "abstract", "class", "ASTRequestor", "{", "CompilationUnitResolver", "compilationUnitResolver", "=", "null", ";", "protected", "ASTRequestor", "(", ")", "{", "}", "public", "void", "acceptAST", "(", "ICompilationUnit", "source", ",", "CompilationUnit", "ast", ")", "{", "}", "public", "void", "acceptBinding", "(", "String", "bindingKey", ",", "IBinding", "binding", ")", "{", "}", "public", "final", "IBinding", "[", "]", "createBindings", "(", "String", "[", "]", "bindingKeys", ")", "{", "int", "length", "=", "bindingKeys", ".", "length", ";", "IBinding", "[", "]", "result", "=", "new", "IBinding", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "null", ";", "if", "(", "this", ".", "compilationUnitResolver", "!=", "null", ")", "{", "result", "[", "i", "]", "=", "this", ".", "compilationUnitResolver", ".", "createBinding", "(", "bindingKeys", "[", "i", "]", ")", ";", "}", "}", "return", "result", ";", "}", "}", "</s>" ]
2,345
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "final", "class", "NormalAnnotation", "extends", "Annotation", "{", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_NAME_PROPERTY", "=", "internalTypeNamePropertyFactory", "(", "NormalAnnotation", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "VALUES_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "NormalAnnotation", ".", "class", ",", "\"values\"", ",", "MemberValuePair", ".", "class", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "NormalAnnotation", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "VALUES_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ASTNode", ".", "NodeList", "values", "=", "new", "ASTNode", ".", "NodeList", "(", "VALUES_PROPERTY", ")", ";", "NormalAnnotation", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "TYPE_NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getTypeName", "(", ")", ";", "}", "else", "{", "setTypeName", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "VALUES_PROPERTY", ")", "{", "return", "values", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalTypeNameProperty", "(", ")", "{", "return", "TYPE_NAME_PROPERTY", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "NORMAL_ANNOTATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "NormalAnnotation", "result", "=", "new", "NormalAnnotation", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setTypeName", "(", "(", "Name", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getTypeName", "(", ")", ")", ")", ";", "result", ".", "values", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "values", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getTypeName", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "values", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "List", "values", "(", ")", "{", "return", "this", ".", "values", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getTypeName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "values", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,346
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "AssertStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "AssertStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "MESSAGE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "AssertStatement", ".", "class", ",", "\"message\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "AssertStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "MESSAGE_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "expression", "=", "null", ";", "private", "Expression", "optionalMessageExpression", "=", "null", ";", "AssertStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "MESSAGE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getMessage", "(", ")", ";", "}", "else", "{", "setMessage", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ASSERT_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "AssertStatement", "result", "=", "new", "AssertStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getExpression", "(", ")", ")", ")", ";", "result", ".", "setMessage", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getMessage", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getMessage", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "expression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "expression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "expression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "expression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "Expression", "getMessage", "(", ")", "{", "return", "this", ".", "optionalMessageExpression", ";", "}", "public", "void", "setMessage", "(", "Expression", "expression", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalMessageExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "MESSAGE_PROPERTY", ")", ";", "this", ".", "optionalMessageExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "MESSAGE_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "expression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalMessageExpression", "==", "null", "?", "0", ":", "getMessage", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,347
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "interface", "IExtendedModifier", "{", "public", "boolean", "isModifier", "(", ")", ";", "public", "boolean", "isAnnotation", "(", ")", ";", "}", "</s>" ]
2,348
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "class", "CompilationUnit", "extends", "ASTNode", "{", "private", "static", "final", "Message", "[", "]", "EMPTY_MESSAGES", "=", "new", "Message", "[", "0", "]", ";", "private", "static", "final", "IProblem", "[", "]", "EMPTY_PROBLEMS", "=", "new", "IProblem", "[", "0", "]", ";", "public", "static", "final", "ChildListPropertyDescriptor", "IMPORTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "CompilationUnit", ".", "class", ",", "\"imports\"", ",", "ImportDeclaration", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "PACKAGE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "CompilationUnit", ".", "class", ",", "\"package\"", ",", "PackageDeclaration", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "public", "static", "final", "ChildListPropertyDescriptor", "TYPES_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "CompilationUnit", ".", "class", ",", "\"types\"", ",", "AbstractTypeDeclaration", ".", "class", ",", "CYCLE_RISK", ")", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "CompilationUnit", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "PACKAGE_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "IMPORTS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "TYPES_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "DefaultCommentMapper", "commentMapper", "=", "null", ";", "private", "ITypeRoot", "typeRoot", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "imports", "=", "new", "ASTNode", ".", "NodeList", "(", "IMPORTS_PROPERTY", ")", ";", "private", "int", "[", "]", "lineEndTable", "=", "Util", ".", "EMPTY_INT_ARRAY", ";", "private", "Message", "[", "]", "messages", ";", "private", "List", "optionalCommentList", "=", "null", ";", "Comment", "[", "]", "optionalCommentTable", "=", "null", ";", "private", "PackageDeclaration", "optionalPackageDeclaration", "=", "null", ";", "private", "IProblem", "[", "]", "problems", "=", "EMPTY_PROBLEMS", ";", "private", "Object", "statementsRecoveryData", ";", "private", "ASTNode", ".", "NodeList", "types", "=", "new", "ASTNode", ".", "NodeList", "(", "TYPES_PROPERTY", ")", ";", "protected", "CompilationUnit", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "protected", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getPackage", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "imports", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "types", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "CompilationUnit", "result", "=", "new", "CompilationUnit", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setPackage", "(", "(", "PackageDeclaration", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getPackage", "(", ")", ")", ")", ";", "result", ".", "imports", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "imports", "(", ")", ")", ")", ";", "result", ".", "types", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "types", "(", ")", ")", ")", ";", "return", "result", ";", "}", "public", "int", "getColumnNumber", "(", "final", "int", "position", ")", "{", "if", "(", "this", ".", "lineEndTable", "==", "null", ")", "return", "-", "2", ";", "final", "int", "line", "=", "getLineNumber", "(", "position", ")", ";", "if", "(", "line", "==", "-", "1", ")", "{", "return", "-", "1", ";", "}", "if", "(", "line", "==", "1", ")", "{", "if", "(", "position", ">=", "getStartPosition", "(", ")", "+", "getLength", "(", ")", ")", "return", "-", "1", ";", "return", "position", ";", "}", "int", "length", "=", "this", ".", "lineEndTable", ".", "length", ";", "final", "int", "previousLineOffset", "=", "this", ".", "lineEndTable", "[", "line", "-", "2", "]", ";", "final", "int", "offsetForLine", "=", "previousLineOffset", "+", "1", ";", "final", "int", "currentLineEnd", "=", "line", "==", "length", "+", "1", "?", "getStartPosition", "(", ")", "+", "getLength", "(", ")", "-", "1", ":", "this", ".", "lineEndTable", "[", "line", "-", "1", "]", ";", "if", "(", "offsetForLine", ">", "currentLineEnd", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "position", "-", "offsetForLine", ";", "}", "}", "public", "ASTNode", "findDeclaringNode", "(", "IBinding", "binding", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "findDeclaringNode", "(", "binding", ")", ";", "}", "public", "ASTNode", "findDeclaringNode", "(", "String", "key", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "findDeclaringNode", "(", "key", ")", ";", "}", "public", "List", "getCommentList", "(", ")", "{", "return", "this", ".", "optionalCommentList", ";", "}", "DefaultCommentMapper", "getCommentMapper", "(", ")", "{", "return", "this", ".", "commentMapper", ";", "}", "public", "int", "getExtendedLength", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "commentMapper", "==", "null", "||", "node", ".", "getAST", "(", ")", "!=", "getAST", "(", ")", ")", "{", "return", "node", ".", "getLength", "(", ")", ";", "}", "else", "{", "return", "this", ".", "commentMapper", ".", "getExtendedLength", "(", "node", ")", ";", "}", "}", "public", "int", "getExtendedStartPosition", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "commentMapper", "==", "null", "||", "node", ".", "getAST", "(", ")", "!=", "getAST", "(", ")", ")", "{", "return", "node", ".", "getStartPosition", "(", ")", ";", "}", "else", "{", "return", "this", ".", "commentMapper", ".", "getExtendedStartPosition", "(", "node", ")", ";", "}", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "return", "this", ".", "typeRoot", ";", "}", "public", "Message", "[", "]", "getMessages", "(", ")", "{", "if", "(", "this", ".", "messages", "==", "null", ")", "{", "int", "problemLength", "=", "this", ".", "problems", ".", "length", ";", "if", "(", "problemLength", "==", "0", ")", "{", "this", ".", "messages", "=", "EMPTY_MESSAGES", ";", "}", "else", "{", "this", ".", "messages", "=", "new", "Message", "[", "problemLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "problemLength", ";", "i", "++", ")", "{", "IProblem", "problem", "=", "this", ".", "problems", "[", "i", "]", ";", "int", "start", "=", "problem", ".", "getSourceStart", "(", ")", ";", "int", "end", "=", "problem", ".", "getSourceEnd", "(", ")", ";", "this", ".", "messages", "[", "i", "]", "=", "new", "Message", "(", "problem", ".", "getMessage", "(", ")", ",", "start", ",", "end", "-", "start", "+", "1", ")", ";", "}", "}", "}", "return", "this", ".", "messages", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "COMPILATION_UNIT", ";", "}", "public", "PackageDeclaration", "getPackage", "(", ")", "{", "return", "this", ".", "optionalPackageDeclaration", ";", "}", "public", "int", "getPosition", "(", "int", "line", ",", "int", "column", ")", "{", "if", "(", "this", ".", "lineEndTable", "==", "null", ")", "return", "-", "2", ";", "if", "(", "line", "<", "1", "||", "column", "<", "0", ")", "return", "-", "1", ";", "int", "length", ";", "if", "(", "(", "length", "=", "this", ".", "lineEndTable", ".", "length", ")", "==", "0", ")", "{", "if", "(", "line", "!=", "1", ")", "return", "-", "1", ";", "return", "column", ">=", "getStartPosition", "(", ")", "+", "getLength", "(", ")", "?", "-", "1", ":", "column", ";", "}", "if", "(", "line", "==", "1", ")", "{", "final", "int", "endOfLine", "=", "this", ".", "lineEndTable", "[", "0", "]", ";", "return", "column", ">", "endOfLine", "?", "-", "1", ":", "column", ";", "}", "else", "if", "(", "line", ">", "length", "+", "1", ")", "{", "return", "-", "1", ";", "}", "final", "int", "previousLineOffset", "=", "this", ".", "lineEndTable", "[", "line", "-", "2", "]", ";", "final", "int", "offsetForLine", "=", "previousLineOffset", "+", "1", ";", "final", "int", "currentLineEnd", "=", "line", "==", "length", "+", "1", "?", "getStartPosition", "(", ")", "+", "getLength", "(", ")", "-", "1", ":", "this", ".", "lineEndTable", "[", "line", "-", "1", "]", ";", "if", "(", "(", "offsetForLine", "+", "column", ")", ">", "currentLineEnd", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "offsetForLine", "+", "column", ";", "}", "}", "public", "IProblem", "[", "]", "getProblems", "(", ")", "{", "return", "this", ".", "problems", ";", "}", "public", "Object", "getStatementsRecoveryData", "(", ")", "{", "return", "this", ".", "statementsRecoveryData", ";", "}", "public", "ITypeRoot", "getTypeRoot", "(", ")", "{", "return", "this", ".", "typeRoot", ";", "}", "public", "List", "imports", "(", ")", "{", "return", "this", ".", "imports", ";", "}", "public", "int", "firstLeadingCommentIndex", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "commentMapper", "==", "null", "||", "node", ".", "getAST", "(", ")", "!=", "getAST", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "this", ".", "commentMapper", ".", "firstLeadingCommentIndex", "(", "node", ")", ";", "}", "public", "int", "lastTrailingCommentIndex", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "commentMapper", "==", "null", "||", "node", ".", "getAST", "(", ")", "!=", "getAST", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "this", ".", "commentMapper", ".", "lastTrailingCommentIndex", "(", "node", ")", ";", "}", "void", "initCommentMapper", "(", "Scanner", "scanner", ")", "{", "this", ".", "commentMapper", "=", "new", "DefaultCommentMapper", "(", "this", ".", "optionalCommentTable", ")", ";", "this", ".", "commentMapper", ".", "initialize", "(", "this", ",", "scanner", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "IMPORTS_PROPERTY", ")", "{", "return", "imports", "(", ")", ";", "}", "if", "(", "property", "==", "TYPES_PROPERTY", ")", "{", "return", "types", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "PACKAGE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getPackage", "(", ")", ";", "}", "else", "{", "setPackage", "(", "(", "PackageDeclaration", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "public", "int", "lineNumber", "(", "int", "position", ")", "{", "int", "lineNumber", "=", "getLineNumber", "(", "position", ")", ";", "return", "lineNumber", "<", "1", "?", "1", ":", "lineNumber", ";", "}", "public", "int", "getLineNumber", "(", "int", "position", ")", "{", "if", "(", "this", ".", "lineEndTable", "==", "null", ")", "return", "-", "2", ";", "int", "length", ";", "if", "(", "(", "length", "=", "this", ".", "lineEndTable", ".", "length", ")", "==", "0", ")", "{", "if", "(", "position", ">=", "getStartPosition", "(", ")", "+", "getLength", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "1", ";", "}", "int", "low", "=", "0", ";", "if", "(", "position", "<", "0", ")", "{", "return", "-", "1", ";", "}", "if", "(", "position", "<=", "this", ".", "lineEndTable", "[", "low", "]", ")", "{", "return", "1", ";", "}", "int", "hi", "=", "length", "-", "1", ";", "if", "(", "position", ">", "this", ".", "lineEndTable", "[", "hi", "]", ")", "{", "if", "(", "position", ">=", "getStartPosition", "(", ")", "+", "getLength", "(", ")", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "length", "+", "1", ";", "}", "}", "while", "(", "true", ")", "{", "if", "(", "low", "+", "1", "==", "hi", ")", "{", "return", "low", "+", "2", ";", "}", "int", "mid", "=", "low", "+", "(", "hi", "-", "low", ")", "/", "2", ";", "if", "(", "position", "<=", "this", ".", "lineEndTable", "[", "mid", "]", ")", "{", "hi", "=", "mid", ";", "}", "else", "{", "low", "=", "mid", ";", "}", "}", "}", "int", "memSize", "(", ")", "{", "int", "size", "=", "BASE_NODE_SIZE", "+", "8", "*", "4", ";", "if", "(", "this", ".", "lineEndTable", "!=", "null", ")", "{", "size", "+=", "HEADERS", "+", "4", "*", "this", ".", "lineEndTable", ".", "length", ";", "}", "if", "(", "this", ".", "optionalCommentTable", "!=", "null", ")", "{", "size", "+=", "HEADERS", "+", "4", "*", "this", ".", "optionalCommentTable", ".", "length", ";", "}", "return", "size", ";", "}", "public", "void", "recordModifications", "(", ")", "{", "getAST", "(", ")", ".", "recordModifications", "(", "this", ")", ";", "}", "public", "TextEdit", "rewrite", "(", "IDocument", "document", ",", "Map", "options", ")", "{", "return", "getAST", "(", ")", ".", "rewrite", "(", "document", ",", "options", ")", ";", "}", "void", "setCommentTable", "(", "Comment", "[", "]", "commentTable", ")", "{", "if", "(", "commentTable", "==", "null", ")", "{", "this", ".", "optionalCommentList", "=", "null", ";", "this", ".", "optionalCommentTable", "=", "null", ";", "}", "else", "{", "int", "nextAvailablePosition", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "commentTable", ".", "length", ";", "i", "++", ")", "{", "Comment", "comment", "=", "commentTable", "[", "i", "]", ";", "if", "(", "comment", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "int", "start", "=", "comment", ".", "getStartPosition", "(", ")", ";", "int", "length", "=", "comment", ".", "getLength", "(", ")", ";", "if", "(", "start", "<", "0", "||", "length", "<", "0", "||", "start", "<", "nextAvailablePosition", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "nextAvailablePosition", "=", "comment", ".", "getStartPosition", "(", ")", "+", "comment", ".", "getLength", "(", ")", ";", "}", "this", ".", "optionalCommentTable", "=", "commentTable", ";", "List", "commentList", "=", "Arrays", ".", "asList", "(", "commentTable", ")", ";", "this", ".", "optionalCommentList", "=", "Collections", ".", "unmodifiableList", "(", "commentList", ")", ";", "}", "}", "void", "setTypeRoot", "(", "ITypeRoot", "typeRoot", ")", "{", "this", ".", "typeRoot", "=", "typeRoot", ";", "}", "void", "setLineEndTable", "(", "int", "[", "]", "lineEndTable", ")", "{", "if", "(", "lineEndTable", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "checkModifiable", "(", ")", ";", "this", ".", "lineEndTable", "=", "lineEndTable", ";", "}", "public", "void", "setPackage", "(", "PackageDeclaration", "pkgDecl", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalPackageDeclaration", ";", "preReplaceChild", "(", "oldChild", ",", "pkgDecl", ",", "PACKAGE_PROPERTY", ")", ";", "this", ".", "optionalPackageDeclaration", "=", "pkgDecl", ";", "postReplaceChild", "(", "oldChild", ",", "pkgDecl", ",", "PACKAGE_PROPERTY", ")", ";", "}", "void", "setProblems", "(", "IProblem", "[", "]", "problems", ")", "{", "if", "(", "problems", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "problems", "=", "problems", ";", "}", "void", "setStatementsRecoveryData", "(", "Object", "data", ")", "{", "this", ".", "statementsRecoveryData", "=", "data", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "int", "treeSize", "(", ")", "{", "int", "size", "=", "memSize", "(", ")", ";", "if", "(", "this", ".", "optionalPackageDeclaration", "!=", "null", ")", "{", "size", "+=", "getPackage", "(", ")", ".", "treeSize", "(", ")", ";", "}", "size", "+=", "this", ".", "imports", ".", "listSize", "(", ")", ";", "size", "+=", "this", ".", "types", ".", "listSize", "(", ")", ";", "if", "(", "this", ".", "optionalCommentList", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "optionalCommentList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Comment", "comment", "=", "(", "Comment", ")", "this", ".", "optionalCommentList", ".", "get", "(", "i", ")", ";", "if", "(", "comment", "!=", "null", "&&", "comment", ".", "getParent", "(", ")", "==", "null", ")", "{", "size", "+=", "comment", ".", "treeSize", "(", ")", ";", "}", "}", "}", "return", "size", ";", "}", "public", "List", "types", "(", ")", "{", "return", "this", ".", "types", ";", "}", "}", "</s>" ]
2,349
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ConstructorDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Initializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ClassScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "CompilationUnitScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodScope", ";", "class", "NodeSearcher", "extends", "ASTVisitor", "{", "public", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", "found", ";", "public", "TypeDeclaration", "enclosingType", ";", "public", "int", "position", ";", "NodeSearcher", "(", "int", "position", ")", "{", "this", ".", "position", "=", "position", ";", "}", "public", "boolean", "visit", "(", "ConstructorDeclaration", "constructorDeclaration", ",", "ClassScope", "scope", ")", "{", "if", "(", "constructorDeclaration", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "constructorDeclaration", ".", "declarationSourceEnd", ")", "{", "this", ".", "found", "=", "constructorDeclaration", ";", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "fieldDeclaration", ",", "MethodScope", "scope", ")", "{", "if", "(", "fieldDeclaration", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "fieldDeclaration", ".", "declarationSourceEnd", ")", "{", "this", ".", "found", "=", "fieldDeclaration", ";", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Initializer", "initializer", ",", "MethodScope", "scope", ")", "{", "if", "(", "initializer", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "initializer", ".", "declarationSourceEnd", ")", "{", "this", ".", "found", "=", "initializer", ";", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "scope", ")", "{", "if", "(", "memberTypeDeclaration", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "memberTypeDeclaration", ".", "declarationSourceEnd", ")", "{", "this", ".", "enclosingType", "=", "memberTypeDeclaration", ";", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "methodDeclaration", ",", "ClassScope", "scope", ")", "{", "if", "(", "methodDeclaration", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "methodDeclaration", ".", "declarationSourceEnd", ")", "{", "this", ".", "found", "=", "methodDeclaration", ";", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "scope", ")", "{", "if", "(", "typeDeclaration", ".", "declarationSourceStart", "<=", "this", ".", "position", "&&", "this", ".", "position", "<=", "typeDeclaration", ".", "declarationSourceEnd", ")", "{", "this", ".", "enclosingType", "=", "typeDeclaration", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
2,350
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ConditionalExpression", "extends", "Expression", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ConditionalExpression", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "THEN_EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ConditionalExpression", ".", "class", ",", "\"\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "ELSE_EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ConditionalExpression", ".", "class", ",", "\"\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "ConditionalExpression", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "THEN_EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ELSE_EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "conditionExpression", "=", "null", ";", "private", "Expression", "thenExpression", "=", "null", ";", "private", "Expression", "elseExpression", "=", "null", ";", "ConditionalExpression", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "THEN_EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getThenExpression", "(", ")", ";", "}", "else", "{", "setThenExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "ELSE_EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getElseExpression", "(", ")", ";", "}", "else", "{", "setElseExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "CONDITIONAL_EXPRESSION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ConditionalExpression", "result", "=", "new", "ConditionalExpression", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "getExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setThenExpression", "(", "(", "Expression", ")", "getThenExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setElseExpression", "(", "(", "Expression", ")", "getElseExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getThenExpression", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getElseExpression", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "conditionExpression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "conditionExpression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "conditionExpression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "conditionExpression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "conditionExpression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "conditionExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "conditionExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "Expression", "getThenExpression", "(", ")", "{", "if", "(", "this", ".", "thenExpression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "thenExpression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "thenExpression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "thenExpression", ",", "THEN_EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "thenExpression", ";", "}", "public", "void", "setThenExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "thenExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "THEN_EXPRESSION_PROPERTY", ")", ";", "this", ".", "thenExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "THEN_EXPRESSION_PROPERTY", ")", ";", "}", "public", "Expression", "getElseExpression", "(", ")", "{", "if", "(", "this", ".", "elseExpression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "elseExpression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "elseExpression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "elseExpression", ",", "ELSE_EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "elseExpression", ";", "}", "public", "void", "setElseExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "elseExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "ELSE_EXPRESSION_PROPERTY", ")", ";", "this", ".", "elseExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "ELSE_EXPRESSION_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "conditionExpression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "thenExpression", "==", "null", "?", "0", ":", "getThenExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "elseExpression", "==", "null", "?", "0", ":", "getElseExpression", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,351
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "Type", "extends", "ASTNode", "{", "Type", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "public", "final", "boolean", "isPrimitiveType", "(", ")", "{", "return", "(", "this", "instanceof", "PrimitiveType", ")", ";", "}", "public", "final", "boolean", "isSimpleType", "(", ")", "{", "return", "(", "this", "instanceof", "SimpleType", ")", ";", "}", "public", "final", "boolean", "isArrayType", "(", ")", "{", "return", "(", "this", "instanceof", "ArrayType", ")", ";", "}", "public", "final", "boolean", "isParameterizedType", "(", ")", "{", "return", "(", "this", "instanceof", "ParameterizedType", ")", ";", "}", "public", "final", "boolean", "isQualifiedType", "(", ")", "{", "return", "(", "this", "instanceof", "QualifiedType", ")", ";", "}", "public", "final", "boolean", "isUnionType", "(", ")", "{", "return", "(", "this", "instanceof", "UnionType", ")", ";", "}", "public", "final", "boolean", "isWildcardType", "(", ")", "{", "return", "(", "this", "instanceof", "WildcardType", ")", ";", "}", "public", "final", "ITypeBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveType", "(", "this", ")", ";", "}", "}", "</s>" ]
2,352
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "MemberRef", "extends", "ASTNode", "implements", "IDocElement", "{", "public", "static", "final", "ChildPropertyDescriptor", "QUALIFIER_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "MemberRef", ".", "class", ",", "\"qualifier\"", ",", "Name", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "MemberRef", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "MemberRef", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "QUALIFIER_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Name", "optionalQualifier", "=", "null", ";", "private", "SimpleName", "memberName", "=", "null", ";", "MemberRef", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "QUALIFIER_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getQualifier", "(", ")", ";", "}", "else", "{", "setQualifier", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "MEMBER_REF", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "MemberRef", "result", "=", "new", "MemberRef", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setQualifier", "(", "(", "Name", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getQualifier", "(", ")", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getName", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getQualifier", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Name", "getQualifier", "(", ")", "{", "return", "this", ".", "optionalQualifier", ";", "}", "public", "void", "setQualifier", "(", "Name", "name", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalQualifier", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "QUALIFIER_PROPERTY", ")", ";", "this", ".", "optionalQualifier", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "QUALIFIER_PROPERTY", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "memberName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "memberName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "memberName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "memberName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "memberName", ";", "}", "public", "void", "setName", "(", "SimpleName", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "memberName", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "memberName", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "public", "final", "IBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveReference", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalQualifier", "==", "null", "?", "0", ":", "getQualifier", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "memberName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,353
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "StringLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Wildcard", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ArrayBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "BaseTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "CaptureBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "FieldBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LocalTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ParameterizedTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "RawTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Scope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeVariableBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "WildcardBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "class", "TypeBinding", "implements", "ITypeBinding", "{", "private", "static", "final", "StringLiteral", "EXPRESSION", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "StringLiteral", "(", "0", ",", "0", ")", ";", "protected", "static", "final", "IMethodBinding", "[", "]", "NO_METHOD_BINDINGS", "=", "new", "IMethodBinding", "[", "0", "]", ";", "private", "static", "final", "String", "NO_NAME", "=", "\"\"", ";", "protected", "static", "final", "ITypeBinding", "[", "]", "NO_TYPE_BINDINGS", "=", "new", "ITypeBinding", "[", "0", "]", ";", "protected", "static", "final", "IVariableBinding", "[", "]", "NO_VARIABLE_BINDINGS", "=", "new", "IVariableBinding", "[", "0", "]", ";", "private", "static", "final", "int", "VALID_MODIFIERS", "=", "Modifier", ".", "PUBLIC", "|", "Modifier", ".", "PROTECTED", "|", "Modifier", ".", "PRIVATE", "|", "Modifier", ".", "ABSTRACT", "|", "Modifier", ".", "STATIC", "|", "Modifier", ".", "FINAL", "|", "Modifier", ".", "STRICTFP", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "binding", ";", "private", "String", "key", ";", "private", "BindingResolver", "resolver", ";", "private", "IVariableBinding", "[", "]", "fields", ";", "private", "IAnnotationBinding", "[", "]", "annotations", ";", "private", "IMethodBinding", "[", "]", "methods", ";", "private", "ITypeBinding", "[", "]", "members", ";", "private", "ITypeBinding", "[", "]", "interfaces", ";", "private", "ITypeBinding", "[", "]", "typeArguments", ";", "private", "ITypeBinding", "[", "]", "bounds", ";", "private", "ITypeBinding", "[", "]", "typeParameters", ";", "public", "TypeBinding", "(", "BindingResolver", "resolver", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "binding", ")", "{", "this", ".", "binding", "=", "binding", ";", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "ITypeBinding", "createArrayType", "(", "int", "dimension", ")", "{", "int", "realDimensions", "=", "dimension", ";", "realDimensions", "+=", "getDimensions", "(", ")", ";", "if", "(", "realDimensions", "<", "1", "||", "realDimensions", ">", "255", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "this", ".", "resolver", ".", "resolveArrayType", "(", "this", ",", "dimension", ")", ";", "}", "public", "IAnnotationBinding", "[", "]", "getAnnotations", "(", ")", "{", "if", "(", "this", ".", "annotations", "!=", "null", ")", "{", "return", "this", ".", "annotations", ";", "}", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", "refType", "=", "null", ";", "if", "(", "this", ".", "binding", "instanceof", "ParameterizedTypeBinding", ")", "{", "refType", "=", "(", "(", "ParameterizedTypeBinding", ")", "this", ".", "binding", ")", ".", "genericType", "(", ")", ";", "}", "else", "if", "(", "this", ".", "binding", ".", "isAnnotationType", "(", ")", "||", "this", ".", "binding", ".", "isClass", "(", ")", "||", "this", ".", "binding", ".", "isEnum", "(", ")", "||", "this", ".", "binding", ".", "isInterface", "(", ")", ")", "{", "refType", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ")", "this", ".", "binding", ";", "}", "if", "(", "refType", "!=", "null", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "[", "]", "internalAnnotations", "=", "refType", ".", "getAnnotations", "(", ")", ";", "int", "length", "=", "internalAnnotations", "==", "null", "?", "0", ":", "internalAnnotations", ".", "length", ";", "if", "(", "length", "!=", "0", ")", "{", "IAnnotationBinding", "[", "]", "tempAnnotations", "=", "new", "IAnnotationBinding", "[", "length", "]", ";", "int", "convertedAnnotationCount", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "internalAnnotation", "=", "internalAnnotations", "[", "i", "]", ";", "IAnnotationBinding", "annotationInstance", "=", "this", ".", "resolver", ".", "getAnnotationInstance", "(", "internalAnnotation", ")", ";", "if", "(", "annotationInstance", "==", "null", ")", "{", "continue", ";", "}", "tempAnnotations", "[", "convertedAnnotationCount", "++", "]", "=", "annotationInstance", ";", "}", "if", "(", "convertedAnnotationCount", "!=", "length", ")", "{", "if", "(", "convertedAnnotationCount", "==", "0", ")", "{", "return", "this", ".", "annotations", "=", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "System", ".", "arraycopy", "(", "tempAnnotations", ",", "0", ",", "(", "tempAnnotations", "=", "new", "IAnnotationBinding", "[", "convertedAnnotationCount", "]", ")", ",", "0", ",", "convertedAnnotationCount", ")", ";", "}", "return", "this", ".", "annotations", "=", "tempAnnotations", ";", "}", "}", "return", "this", ".", "annotations", "=", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "public", "String", "getBinaryName", "(", ")", "{", "if", "(", "this", ".", "binding", ".", "isCapture", "(", ")", ")", "{", "return", "null", ";", "}", "else", "if", "(", "this", ".", "binding", ".", "isTypeVariable", "(", ")", ")", "{", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", "declaring", "=", "typeVariableBinding", ".", "declaringElement", ";", "StringBuffer", "binaryName", "=", "new", "StringBuffer", "(", ")", ";", "switch", "(", "declaring", ".", "kind", "(", ")", ")", "{", "case", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ".", "METHOD", ":", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "declaring", ";", "char", "[", "]", "constantPoolName", "=", "methodBinding", ".", "declaringClass", ".", "constantPoolName", "(", ")", ";", "if", "(", "constantPoolName", "==", "null", ")", "return", "null", ";", "binaryName", ".", "append", "(", "CharOperation", ".", "replaceOnCopy", "(", "constantPoolName", ",", "'/'", ",", "'.'", ")", ")", ".", "append", "(", "'$'", ")", ".", "append", "(", "methodBinding", ".", "signature", "(", ")", ")", ".", "append", "(", "'$'", ")", ".", "append", "(", "typeVariableBinding", ".", "sourceName", ")", ";", "break", ";", "default", ":", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "typeBinding", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ")", "declaring", ";", "constantPoolName", "=", "typeBinding", ".", "constantPoolName", "(", ")", ";", "if", "(", "constantPoolName", "==", "null", ")", "return", "null", ";", "binaryName", ".", "append", "(", "CharOperation", ".", "replaceOnCopy", "(", "constantPoolName", ",", "'/'", ",", "'.'", ")", ")", ".", "append", "(", "'$'", ")", ".", "append", "(", "typeVariableBinding", ".", "sourceName", ")", ";", "}", "return", "String", ".", "valueOf", "(", "binaryName", ")", ";", "}", "char", "[", "]", "constantPoolName", "=", "this", ".", "binding", ".", "constantPoolName", "(", ")", ";", "if", "(", "constantPoolName", "==", "null", ")", "return", "null", ";", "char", "[", "]", "dotSeparated", "=", "CharOperation", ".", "replaceOnCopy", "(", "constantPoolName", ",", "'/'", ",", "'.'", ")", ";", "return", "new", "String", "(", "dotSeparated", ")", ";", "}", "public", "ITypeBinding", "getBound", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "this", ".", "binding", ";", "if", "(", "wildcardBinding", ".", "bound", "!=", "null", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "wildcardBinding", ".", "bound", ")", ";", "}", "break", ";", "}", "return", "null", ";", "}", "public", "ITypeBinding", "getGenericTypeOfWildcardType", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "this", ".", "binding", ";", "if", "(", "wildcardBinding", ".", "genericType", "!=", "null", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "wildcardBinding", ".", "genericType", ")", ";", "}", "break", ";", "}", "return", "null", ";", "}", "public", "int", "getRank", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "this", ".", "binding", ";", "return", "wildcardBinding", ".", "rank", ";", "default", ":", "return", "-", "1", ";", "}", "}", "public", "ITypeBinding", "getComponentType", "(", ")", "{", "if", "(", "!", "isArray", "(", ")", ")", "{", "return", "null", ";", "}", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "this", ".", "binding", ";", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "arrayBinding", ".", "elementsType", "(", ")", ")", ";", "}", "public", "synchronized", "IVariableBinding", "[", "]", "getDeclaredFields", "(", ")", "{", "if", "(", "this", ".", "fields", "!=", "null", ")", "{", "return", "this", ".", "fields", ";", "}", "try", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "FieldBinding", "[", "]", "fieldBindings", "=", "referenceBinding", ".", "availableFields", "(", ")", ";", "int", "length", "=", "fieldBindings", ".", "length", ";", "if", "(", "length", "!=", "0", ")", "{", "int", "convertedFieldCount", "=", "0", ";", "IVariableBinding", "[", "]", "newFields", "=", "new", "IVariableBinding", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "FieldBinding", "fieldBinding", "=", "fieldBindings", "[", "i", "]", ";", "IVariableBinding", "variableBinding", "=", "this", ".", "resolver", ".", "getVariableBinding", "(", "fieldBinding", ")", ";", "if", "(", "variableBinding", "!=", "null", ")", "{", "newFields", "[", "convertedFieldCount", "++", "]", "=", "variableBinding", ";", "}", "}", "if", "(", "convertedFieldCount", "!=", "length", ")", "{", "if", "(", "convertedFieldCount", "==", "0", ")", "{", "return", "this", ".", "fields", "=", "NO_VARIABLE_BINDINGS", ";", "}", "System", ".", "arraycopy", "(", "newFields", ",", "0", ",", "(", "newFields", "=", "new", "IVariableBinding", "[", "convertedFieldCount", "]", ")", ",", "0", ",", "convertedFieldCount", ")", ";", "}", "return", "this", ".", "fields", "=", "newFields", ";", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "return", "this", ".", "fields", "=", "NO_VARIABLE_BINDINGS", ";", "}", "public", "synchronized", "IMethodBinding", "[", "]", "getDeclaredMethods", "(", ")", "{", "if", "(", "this", ".", "methods", "!=", "null", ")", "{", "return", "this", ".", "methods", ";", "}", "try", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", "[", "]", "internalMethods", "=", "referenceBinding", ".", "availableMethods", "(", ")", ";", "int", "length", "=", "internalMethods", ".", "length", ";", "if", "(", "length", "!=", "0", ")", "{", "int", "convertedMethodCount", "=", "0", ";", "IMethodBinding", "[", "]", "newMethods", "=", "new", "IMethodBinding", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", "methodBinding", "=", "internalMethods", "[", "i", "]", ";", "if", "(", "methodBinding", ".", "isDefaultAbstract", "(", ")", "||", "methodBinding", ".", "isSynthetic", "(", ")", "||", "(", "methodBinding", ".", "isConstructor", "(", ")", "&&", "isInterface", "(", ")", ")", ")", "{", "continue", ";", "}", "IMethodBinding", "methodBinding2", "=", "this", ".", "resolver", ".", "getMethodBinding", "(", "methodBinding", ")", ";", "if", "(", "methodBinding2", "!=", "null", ")", "{", "newMethods", "[", "convertedMethodCount", "++", "]", "=", "methodBinding2", ";", "}", "}", "if", "(", "convertedMethodCount", "!=", "length", ")", "{", "if", "(", "convertedMethodCount", "==", "0", ")", "{", "return", "this", ".", "methods", "=", "NO_METHOD_BINDINGS", ";", "}", "System", ".", "arraycopy", "(", "newMethods", ",", "0", ",", "(", "newMethods", "=", "new", "IMethodBinding", "[", "convertedMethodCount", "]", ")", ",", "0", ",", "convertedMethodCount", ")", ";", "}", "return", "this", ".", "methods", "=", "newMethods", ";", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "return", "this", ".", "methods", "=", "NO_METHOD_BINDINGS", ";", "}", "public", "int", "getDeclaredModifiers", "(", ")", "{", "return", "getModifiers", "(", ")", ";", "}", "public", "synchronized", "ITypeBinding", "[", "]", "getDeclaredTypes", "(", ")", "{", "if", "(", "this", ".", "members", "!=", "null", ")", "{", "return", "this", ".", "members", ";", "}", "try", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "ReferenceBinding", "[", "]", "internalMembers", "=", "referenceBinding", ".", "memberTypes", "(", ")", ";", "int", "length", "=", "internalMembers", ".", "length", ";", "if", "(", "length", "!=", "0", ")", "{", "ITypeBinding", "[", "]", "newMembers", "=", "new", "ITypeBinding", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "internalMembers", "[", "i", "]", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "return", "this", ".", "members", "=", "NO_TYPE_BINDINGS", ";", "}", "newMembers", "[", "i", "]", "=", "typeBinding", ";", "}", "return", "this", ".", "members", "=", "newMembers", ";", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "return", "this", ".", "members", "=", "NO_TYPE_BINDINGS", ";", "}", "public", "synchronized", "IMethodBinding", "getDeclaringMethod", "(", ")", "{", "if", "(", "this", ".", "binding", "instanceof", "LocalTypeBinding", ")", "{", "LocalTypeBinding", "localTypeBinding", "=", "(", "LocalTypeBinding", ")", "this", ".", "binding", ";", "MethodBinding", "methodBinding", "=", "localTypeBinding", ".", "enclosingMethod", ";", "if", "(", "methodBinding", "!=", "null", ")", "{", "try", "{", "return", "this", ".", "resolver", ".", "getMethodBinding", "(", "localTypeBinding", ".", "enclosingMethod", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "else", "if", "(", "this", ".", "binding", ".", "isTypeVariable", "(", ")", ")", "{", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "Binding", "declaringElement", "=", "typeVariableBinding", ".", "declaringElement", ";", "if", "(", "declaringElement", "instanceof", "MethodBinding", ")", "{", "try", "{", "return", "this", ".", "resolver", ".", "getMethodBinding", "(", "(", "MethodBinding", ")", "declaringElement", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "return", "null", ";", "}", "public", "synchronized", "ITypeBinding", "getDeclaringClass", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "if", "(", "referenceBinding", ".", "isNestedType", "(", ")", ")", "{", "try", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "referenceBinding", ".", "enclosingType", "(", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "else", "if", "(", "this", ".", "binding", ".", "isTypeVariable", "(", ")", ")", "{", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "Binding", "declaringElement", "=", "typeVariableBinding", ".", "isCapture", "(", ")", "?", "(", "(", "CaptureBinding", ")", "typeVariableBinding", ")", ".", "sourceType", ":", "typeVariableBinding", ".", "declaringElement", ";", "if", "(", "declaringElement", "instanceof", "ReferenceBinding", ")", "{", "try", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "(", "ReferenceBinding", ")", "declaringElement", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "return", "null", ";", "}", "public", "int", "getDimensions", "(", ")", "{", "if", "(", "!", "isArray", "(", ")", ")", "{", "return", "0", ";", "}", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "this", ".", "binding", ";", "return", "arrayBinding", ".", "dimensions", ";", "}", "public", "ITypeBinding", "getElementType", "(", ")", "{", "if", "(", "!", "isArray", "(", ")", ")", "{", "return", "null", ";", "}", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "this", ".", "binding", ";", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "arrayBinding", ".", "leafComponentType", ")", ";", "}", "public", "ITypeBinding", "getTypeDeclaration", "(", ")", "{", "if", "(", "this", ".", "binding", "instanceof", "ParameterizedTypeBinding", ")", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "(", "(", "ParameterizedTypeBinding", ")", "this", ".", "binding", ")", ".", "genericType", "(", ")", ")", ";", "return", "this", ";", "}", "public", "ITypeBinding", "getErasure", "(", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "this", ".", "binding", ".", "erasure", "(", ")", ")", ";", "}", "public", "synchronized", "ITypeBinding", "[", "]", "getInterfaces", "(", ")", "{", "if", "(", "this", ".", "interfaces", "!=", "null", ")", "{", "return", "this", ".", "interfaces", ";", "}", "if", "(", "this", ".", "binding", "==", "null", ")", "return", "this", ".", "interfaces", "=", "NO_TYPE_BINDINGS", ";", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "ARRAY_TYPE", ":", "case", "Binding", ".", "BASE_TYPE", ":", "return", "this", ".", "interfaces", "=", "NO_TYPE_BINDINGS", ";", "}", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "ReferenceBinding", "[", "]", "internalInterfaces", "=", "null", ";", "try", "{", "internalInterfaces", "=", "referenceBinding", ".", "superInterfaces", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "int", "length", "=", "internalInterfaces", "==", "null", "?", "0", ":", "internalInterfaces", ".", "length", ";", "if", "(", "length", "!=", "0", ")", "{", "ITypeBinding", "[", "]", "newInterfaces", "=", "new", "ITypeBinding", "[", "length", "]", ";", "int", "interfacesCounter", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "internalInterfaces", "[", "i", "]", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "continue", ";", "}", "newInterfaces", "[", "interfacesCounter", "++", "]", "=", "typeBinding", ";", "}", "if", "(", "length", "!=", "interfacesCounter", ")", "{", "System", ".", "arraycopy", "(", "newInterfaces", ",", "0", ",", "(", "newInterfaces", "=", "new", "ITypeBinding", "[", "interfacesCounter", "]", ")", ",", "0", ",", "interfacesCounter", ")", ";", "}", "return", "this", ".", "interfaces", "=", "newInterfaces", ";", "}", "return", "this", ".", "interfaces", "=", "NO_TYPE_BINDINGS", ";", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "JavaElement", "element", "=", "getUnresolvedJavaElement", "(", ")", ";", "if", "(", "element", "!=", "null", ")", "return", "element", ".", "resolved", "(", "this", ".", "binding", ")", ";", "if", "(", "isRecovered", "(", ")", ")", "{", "IPackageBinding", "packageBinding", "=", "getPackage", "(", ")", ";", "if", "(", "packageBinding", "!=", "null", ")", "{", "final", "IJavaElement", "javaElement", "=", "packageBinding", ".", "getJavaElement", "(", ")", ";", "if", "(", "javaElement", "!=", "null", "&&", "javaElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "return", "(", "(", "PackageFragment", ")", "javaElement", ")", ".", "getCompilationUnit", "(", "new", "String", "(", "this", ".", "binding", ".", "sourceName", "(", ")", ")", "+", "SuffixConstants", ".", "SUFFIX_STRING_java", ")", ".", "getType", "(", "this", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "null", ";", "}", "return", "null", ";", "}", "private", "JavaElement", "getUnresolvedJavaElement", "(", ")", "{", "return", "getUnresolvedJavaElement", "(", "this", ".", "binding", ")", ";", "}", "private", "JavaElement", "getUnresolvedJavaElement", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "typeBinding", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "resolver", "instanceof", "DefaultBindingResolver", ")", "{", "DefaultBindingResolver", "defaultBindingResolver", "=", "(", "DefaultBindingResolver", ")", "this", ".", "resolver", ";", "if", "(", "!", "defaultBindingResolver", ".", "fromJavaProject", ")", "return", "null", ";", "return", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "getUnresolvedJavaElement", "(", "typeBinding", ",", "defaultBindingResolver", ".", "workingCopyOwner", ",", "defaultBindingResolver", ".", "getBindingsToNodesMap", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "String", "getKey", "(", ")", "{", "if", "(", "this", ".", "key", "==", "null", ")", "{", "this", ".", "key", "=", "new", "String", "(", "this", ".", "binding", ".", "computeUniqueKey", "(", ")", ")", ";", "}", "return", "this", ".", "key", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "IBinding", ".", "TYPE", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "if", "(", "isClass", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "final", "int", "accessFlags", "=", "referenceBinding", ".", "getAccessFlags", "(", ")", "&", "VALID_MODIFIERS", ";", "if", "(", "referenceBinding", ".", "isAnonymousType", "(", ")", ")", "{", "return", "accessFlags", "&", "~", "Modifier", ".", "FINAL", ";", "}", "return", "accessFlags", ";", "}", "else", "if", "(", "isAnnotation", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "final", "int", "accessFlags", "=", "referenceBinding", ".", "getAccessFlags", "(", ")", "&", "VALID_MODIFIERS", ";", "return", "accessFlags", "&", "~", "(", "ClassFileConstants", ".", "AccAbstract", "|", "ClassFileConstants", ".", "AccInterface", "|", "ClassFileConstants", ".", "AccAnnotation", ")", ";", "}", "else", "if", "(", "isInterface", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "final", "int", "accessFlags", "=", "referenceBinding", ".", "getAccessFlags", "(", ")", "&", "VALID_MODIFIERS", ";", "return", "accessFlags", "&", "~", "(", "ClassFileConstants", ".", "AccAbstract", "|", "ClassFileConstants", ".", "AccInterface", ")", ";", "}", "else", "if", "(", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "final", "int", "accessFlags", "=", "referenceBinding", ".", "getAccessFlags", "(", ")", "&", "VALID_MODIFIERS", ";", "return", "accessFlags", "&", "~", "ClassFileConstants", ".", "AccEnum", ";", "}", "else", "{", "return", "Modifier", ".", "NONE", ";", "}", "}", "public", "String", "getName", "(", ")", "{", "StringBuffer", "buffer", ";", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "this", ".", "binding", ";", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_NAME", ")", ";", "if", "(", "wildcardBinding", ".", "bound", "!=", "null", ")", "{", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "SUPER", ":", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_SUPER", ")", ";", "break", ";", "case", "Wildcard", ".", "EXTENDS", ":", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_EXTENDS", ")", ";", "}", "buffer", ".", "append", "(", "getBound", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "case", "Binding", ".", "TYPE_PARAMETER", ":", "if", "(", "isCapture", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "return", "new", "String", "(", "typeVariableBinding", ".", "sourceName", ")", ";", "case", "Binding", ".", "PARAMETERIZED_TYPE", ":", "ParameterizedTypeBinding", "parameterizedTypeBinding", "=", "(", "ParameterizedTypeBinding", ")", "this", ".", "binding", ";", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "parameterizedTypeBinding", ".", "sourceName", "(", ")", ")", ";", "ITypeBinding", "[", "]", "tArguments", "=", "getTypeArguments", "(", ")", ";", "final", "int", "typeArgumentsLength", "=", "tArguments", ".", "length", ";", "if", "(", "typeArgumentsLength", "!=", "0", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArgumentsLength", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "tArguments", "[", "i", "]", ".", "getName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "case", "Binding", ".", "RAW_TYPE", ":", "return", "getTypeDeclaration", "(", ")", ".", "getName", "(", ")", ";", "case", "Binding", ".", "ARRAY_TYPE", ":", "ITypeBinding", "elementType", "=", "getElementType", "(", ")", ";", "if", "(", "elementType", ".", "isLocal", "(", ")", "||", "elementType", ".", "isAnonymous", "(", ")", "||", "elementType", ".", "isCapture", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "int", "dimensions", "=", "getDimensions", "(", ")", ";", "char", "[", "]", "brackets", "=", "new", "char", "[", "dimensions", "*", "2", "]", ";", "for", "(", "int", "i", "=", "dimensions", "*", "2", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "2", ")", "{", "brackets", "[", "i", "]", "=", "']'", ";", "brackets", "[", "i", "-", "1", "]", "=", "'['", ";", "}", "buffer", "=", "new", "StringBuffer", "(", "elementType", ".", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "brackets", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "default", ":", "if", "(", "isPrimitive", "(", ")", "||", "isNullType", "(", ")", ")", "{", "BaseTypeBinding", "baseTypeBinding", "=", "(", "BaseTypeBinding", ")", "this", ".", "binding", ";", "return", "new", "String", "(", "baseTypeBinding", ".", "simpleName", ")", ";", "}", "if", "(", "isAnonymous", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "return", "new", "String", "(", "this", ".", "binding", ".", "sourceName", "(", ")", ")", ";", "}", "}", "public", "IPackageBinding", "getPackage", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "BASE_TYPE", ":", "case", "Binding", ".", "ARRAY_TYPE", ":", "case", "Binding", ".", "TYPE_PARAMETER", ":", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "return", "null", ";", "}", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "this", ".", "resolver", ".", "getPackageBinding", "(", "referenceBinding", ".", "getPackage", "(", ")", ")", ";", "}", "public", "String", "getQualifiedName", "(", ")", "{", "StringBuffer", "buffer", ";", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "this", ".", "binding", ";", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_NAME", ")", ";", "final", "ITypeBinding", "bound", "=", "getBound", "(", ")", ";", "if", "(", "bound", "!=", "null", ")", "{", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "SUPER", ":", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_SUPER", ")", ";", "break", ";", "case", "Wildcard", ".", "EXTENDS", ":", "buffer", ".", "append", "(", "TypeConstants", ".", "WILDCARD_EXTENDS", ")", ";", "}", "buffer", ".", "append", "(", "bound", ".", "getQualifiedName", "(", ")", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "case", "Binding", ".", "RAW_TYPE", ":", "return", "getTypeDeclaration", "(", ")", ".", "getQualifiedName", "(", ")", ";", "case", "Binding", ".", "ARRAY_TYPE", ":", "ITypeBinding", "elementType", "=", "getElementType", "(", ")", ";", "if", "(", "elementType", ".", "isLocal", "(", ")", "||", "elementType", ".", "isAnonymous", "(", ")", "||", "elementType", ".", "isCapture", "(", ")", ")", "{", "return", "elementType", ".", "getQualifiedName", "(", ")", ";", "}", "final", "int", "dimensions", "=", "getDimensions", "(", ")", ";", "char", "[", "]", "brackets", "=", "new", "char", "[", "dimensions", "*", "2", "]", ";", "for", "(", "int", "i", "=", "dimensions", "*", "2", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "2", ")", "{", "brackets", "[", "i", "]", "=", "']'", ";", "brackets", "[", "i", "-", "1", "]", "=", "'['", ";", "}", "buffer", "=", "new", "StringBuffer", "(", "elementType", ".", "getQualifiedName", "(", ")", ")", ";", "buffer", ".", "append", "(", "brackets", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "case", "Binding", ".", "TYPE_PARAMETER", ":", "if", "(", "isCapture", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "return", "new", "String", "(", "typeVariableBinding", ".", "sourceName", ")", ";", "case", "Binding", ".", "PARAMETERIZED_TYPE", ":", "if", "(", "this", ".", "binding", ".", "isLocalType", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "isMember", "(", ")", ")", "{", "buffer", ".", "append", "(", "getDeclaringClass", "(", ")", ".", "getQualifiedName", "(", ")", ")", ".", "append", "(", "'.'", ")", ";", "ParameterizedTypeBinding", "parameterizedTypeBinding", "=", "(", "ParameterizedTypeBinding", ")", "this", ".", "binding", ";", "buffer", ".", "append", "(", "parameterizedTypeBinding", ".", "sourceName", "(", ")", ")", ";", "ITypeBinding", "[", "]", "tArguments", "=", "getTypeArguments", "(", ")", ";", "final", "int", "typeArgumentsLength", "=", "tArguments", ".", "length", ";", "if", "(", "typeArgumentsLength", "!=", "0", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArgumentsLength", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "tArguments", "[", "i", "]", ".", "getQualifiedName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "buffer", ".", "append", "(", "getTypeDeclaration", "(", ")", ".", "getQualifiedName", "(", ")", ")", ";", "ITypeBinding", "[", "]", "tArguments", "=", "getTypeArguments", "(", ")", ";", "final", "int", "typeArgumentsLength", "=", "tArguments", ".", "length", ";", "if", "(", "typeArgumentsLength", "!=", "0", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArgumentsLength", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "tArguments", "[", "i", "]", ".", "getQualifiedName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "default", ":", "if", "(", "isAnonymous", "(", ")", "||", "this", ".", "binding", ".", "isLocalType", "(", ")", ")", "{", "return", "NO_NAME", ";", "}", "if", "(", "isPrimitive", "(", ")", "||", "isNullType", "(", ")", ")", "{", "BaseTypeBinding", "baseTypeBinding", "=", "(", "BaseTypeBinding", ")", "this", ".", "binding", ";", "return", "new", "String", "(", "baseTypeBinding", ".", "simpleName", ")", ";", "}", "if", "(", "isMember", "(", ")", ")", "{", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "getDeclaringClass", "(", ")", ".", "getQualifiedName", "(", ")", ")", ".", "append", "(", "'.'", ")", ";", "buffer", ".", "append", "(", "getName", "(", ")", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "PackageBinding", "packageBinding", "=", "this", ".", "binding", ".", "getPackage", "(", ")", ";", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "packageBinding", "!=", "null", "&&", "packageBinding", ".", "compoundName", "!=", "CharOperation", ".", "NO_CHAR_CHAR", ")", "{", "buffer", ".", "append", "(", "CharOperation", ".", "concatWith", "(", "packageBinding", ".", "compoundName", ",", "'.'", ")", ")", ".", "append", "(", "'.'", ")", ";", "}", "buffer", ".", "append", "(", "getName", "(", ")", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "}", "public", "synchronized", "ITypeBinding", "getSuperclass", "(", ")", "{", "if", "(", "this", ".", "binding", "==", "null", ")", "return", "null", ";", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "ARRAY_TYPE", ":", "case", "Binding", ".", "BASE_TYPE", ":", "return", "null", ";", "default", ":", "if", "(", "this", ".", "binding", ".", "isInterface", "(", ")", ")", "return", "null", ";", "}", "ReferenceBinding", "superclass", "=", "null", ";", "try", "{", "superclass", "=", "(", "(", "ReferenceBinding", ")", "this", ".", "binding", ")", ".", "superclass", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "return", "this", ".", "resolver", ".", "resolveWellKnownType", "(", "\"\"", ")", ";", "}", "if", "(", "superclass", "==", "null", ")", "{", "return", "null", ";", "}", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "superclass", ")", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeArguments", "(", ")", "{", "if", "(", "this", ".", "typeArguments", "!=", "null", ")", "{", "return", "this", ".", "typeArguments", ";", "}", "if", "(", "this", ".", "binding", ".", "isParameterizedTypeWithActualArguments", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedTypeBinding", "=", "(", "ParameterizedTypeBinding", ")", "this", ".", "binding", ";", "final", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "[", "]", "arguments", "=", "parameterizedTypeBinding", ".", "arguments", ";", "int", "argumentsLength", "=", "arguments", ".", "length", ";", "ITypeBinding", "[", "]", "newTypeArguments", "=", "new", "ITypeBinding", "[", "argumentsLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argumentsLength", ";", "i", "++", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "arguments", "[", "i", "]", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "return", "this", ".", "typeArguments", "=", "NO_TYPE_BINDINGS", ";", "}", "newTypeArguments", "[", "i", "]", "=", "typeBinding", ";", "}", "return", "this", ".", "typeArguments", "=", "newTypeArguments", ";", "}", "return", "this", ".", "typeArguments", "=", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeBounds", "(", ")", "{", "if", "(", "this", ".", "bounds", "!=", "null", ")", "{", "return", "this", ".", "bounds", ";", "}", "if", "(", "this", ".", "binding", "instanceof", "TypeVariableBinding", ")", "{", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "ReferenceBinding", "varSuperclass", "=", "typeVariableBinding", ".", "superclass", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "firstClassOrArrayBound", "=", "typeVariableBinding", ".", "firstBound", ";", "int", "boundsLength", "=", "0", ";", "if", "(", "firstClassOrArrayBound", "!=", "null", ")", "{", "if", "(", "firstClassOrArrayBound", "==", "varSuperclass", ")", "{", "boundsLength", "++", ";", "}", "else", "if", "(", "firstClassOrArrayBound", ".", "isArrayType", "(", ")", ")", "{", "boundsLength", "++", ";", "}", "else", "{", "firstClassOrArrayBound", "=", "null", ";", "}", "}", "ReferenceBinding", "[", "]", "superinterfaces", "=", "typeVariableBinding", ".", "superInterfaces", "(", ")", ";", "int", "superinterfacesLength", "=", "0", ";", "if", "(", "superinterfaces", "!=", "null", ")", "{", "superinterfacesLength", "=", "superinterfaces", ".", "length", ";", "boundsLength", "+=", "superinterfacesLength", ";", "}", "if", "(", "boundsLength", "!=", "0", ")", "{", "ITypeBinding", "[", "]", "typeBounds", "=", "new", "ITypeBinding", "[", "boundsLength", "]", ";", "int", "boundsIndex", "=", "0", ";", "if", "(", "firstClassOrArrayBound", "!=", "null", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "firstClassOrArrayBound", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "return", "this", ".", "bounds", "=", "NO_TYPE_BINDINGS", ";", "}", "typeBounds", "[", "boundsIndex", "++", "]", "=", "typeBinding", ";", "}", "if", "(", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "superinterfacesLength", ";", "i", "++", ",", "boundsIndex", "++", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "superinterfaces", "[", "i", "]", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "return", "this", ".", "bounds", "=", "NO_TYPE_BINDINGS", ";", "}", "typeBounds", "[", "boundsIndex", "]", "=", "typeBinding", ";", "}", "}", "return", "this", ".", "bounds", "=", "typeBounds", ";", "}", "}", "return", "this", ".", "bounds", "=", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeParameters", "(", ")", "{", "if", "(", "this", ".", "typeParameters", "!=", "null", ")", "{", "return", "this", ".", "typeParameters", ";", "}", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "RAW_TYPE", ":", "case", "Binding", ".", "PARAMETERIZED_TYPE", ":", "return", "this", ".", "typeParameters", "=", "NO_TYPE_BINDINGS", ";", "}", "TypeVariableBinding", "[", "]", "typeVariableBindings", "=", "this", ".", "binding", ".", "typeVariables", "(", ")", ";", "int", "typeVariableBindingsLength", "=", "typeVariableBindings", "==", "null", "?", "0", ":", "typeVariableBindings", ".", "length", ";", "if", "(", "typeVariableBindingsLength", "!=", "0", ")", "{", "ITypeBinding", "[", "]", "newTypeParameters", "=", "new", "ITypeBinding", "[", "typeVariableBindingsLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeVariableBindingsLength", ";", "i", "++", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "resolver", ".", "getTypeBinding", "(", "typeVariableBindings", "[", "i", "]", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "{", "return", "this", ".", "typeParameters", "=", "NO_TYPE_BINDINGS", ";", "}", "newTypeParameters", "[", "i", "]", "=", "typeBinding", ";", "}", "return", "this", ".", "typeParameters", "=", "newTypeParameters", ";", "}", "return", "this", ".", "typeParameters", "=", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "getWildcard", "(", ")", "{", "if", "(", "this", ".", "binding", "instanceof", "CaptureBinding", ")", "{", "CaptureBinding", "captureBinding", "=", "(", "CaptureBinding", ")", "this", ".", "binding", ";", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "captureBinding", ".", "wildcard", ")", ";", "}", "return", "null", ";", "}", "public", "boolean", "isGenericType", "(", ")", "{", "if", "(", "isRawType", "(", ")", ")", "{", "return", "false", ";", "}", "TypeVariableBinding", "[", "]", "typeVariableBindings", "=", "this", ".", "binding", ".", "typeVariables", "(", ")", ";", "return", "(", "typeVariableBindings", "!=", "null", "&&", "typeVariableBindings", ".", "length", ">", "0", ")", ";", "}", "public", "boolean", "isAnnotation", "(", ")", "{", "return", "this", ".", "binding", ".", "isAnnotationType", "(", ")", ";", "}", "public", "boolean", "isAnonymous", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "referenceBinding", ".", "isAnonymousType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isArray", "(", ")", "{", "return", "this", ".", "binding", ".", "isArrayType", "(", ")", ";", "}", "public", "boolean", "isAssignmentCompatible", "(", "ITypeBinding", "type", ")", "{", "try", "{", "if", "(", "this", "==", "type", ")", "return", "true", ";", "if", "(", "!", "(", "type", "instanceof", "TypeBinding", ")", ")", "return", "false", ";", "TypeBinding", "other", "=", "(", "TypeBinding", ")", "type", ";", "Scope", "scope", "=", "this", ".", "resolver", ".", "scope", "(", ")", ";", "if", "(", "scope", "==", "null", ")", "return", "false", ";", "return", "this", ".", "binding", ".", "isCompatibleWith", "(", "other", ".", "binding", ")", "||", "scope", ".", "isBoxingCompatibleWith", "(", "this", ".", "binding", ",", "other", ".", "binding", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "return", "false", ";", "}", "}", "public", "boolean", "isCapture", "(", ")", "{", "return", "this", ".", "binding", ".", "isCapture", "(", ")", ";", "}", "public", "boolean", "isCastCompatible", "(", "ITypeBinding", "type", ")", "{", "try", "{", "Scope", "scope", "=", "this", ".", "resolver", ".", "scope", "(", ")", ";", "if", "(", "scope", "==", "null", ")", "return", "false", ";", "if", "(", "!", "(", "type", "instanceof", "TypeBinding", ")", ")", "return", "false", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "expressionType", "=", "(", "(", "TypeBinding", ")", "type", ")", ".", "binding", ";", "expressionType", "=", "expressionType", ".", "capture", "(", "scope", ",", "0", ")", ";", "return", "TypeBinding", ".", "EXPRESSION", ".", "checkCastTypesCompatibility", "(", "scope", ",", "this", ".", "binding", ",", "expressionType", ",", "null", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "return", "false", ";", "}", "}", "public", "boolean", "isClass", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "TYPE_PARAMETER", ":", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "return", "false", ";", "}", "return", "this", ".", "binding", ".", "isClass", "(", ")", ";", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "referenceBinding", ".", "isDeprecated", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isEnum", "(", ")", "{", "return", "this", ".", "binding", ".", "isEnum", "(", ")", ";", "}", "public", "boolean", "isEqualTo", "(", "IBinding", "other", ")", "{", "if", "(", "other", "==", "this", ")", "{", "return", "true", ";", "}", "if", "(", "other", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "(", "other", "instanceof", "TypeBinding", ")", ")", "{", "return", "false", ";", "}", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "otherBinding", "=", "(", "(", "TypeBinding", ")", "other", ")", ".", "binding", ";", "return", "BindingComparator", ".", "isEqual", "(", "this", ".", "binding", ",", "otherBinding", ")", ";", "}", "public", "boolean", "isFromSource", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "if", "(", "referenceBinding", ".", "isRawType", "(", ")", ")", "{", "return", "!", "(", "(", "RawTypeBinding", ")", "referenceBinding", ")", ".", "genericType", "(", ")", ".", "isBinaryBinding", "(", ")", ";", "}", "else", "if", "(", "referenceBinding", ".", "isParameterizedType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedTypeBinding", "=", "(", "ParameterizedTypeBinding", ")", "referenceBinding", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "erasure", "=", "parameterizedTypeBinding", ".", "erasure", "(", ")", ";", "if", "(", "erasure", "instanceof", "ReferenceBinding", ")", "{", "return", "!", "(", "(", "ReferenceBinding", ")", "erasure", ")", ".", "isBinaryBinding", "(", ")", ";", "}", "return", "false", ";", "}", "else", "{", "return", "!", "referenceBinding", ".", "isBinaryBinding", "(", ")", ";", "}", "}", "else", "if", "(", "isTypeVariable", "(", ")", ")", "{", "final", "TypeVariableBinding", "typeVariableBinding", "=", "(", "TypeVariableBinding", ")", "this", ".", "binding", ";", "final", "Binding", "declaringElement", "=", "typeVariableBinding", ".", "declaringElement", ";", "if", "(", "declaringElement", "instanceof", "MethodBinding", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "declaringElement", ";", "return", "!", "methodBinding", ".", "declaringClass", ".", "isBinaryBinding", "(", ")", ";", "}", "else", "{", "final", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "typeBinding", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ")", "declaringElement", ";", "if", "(", "typeBinding", "instanceof", "ReferenceBinding", ")", "{", "return", "!", "(", "(", "ReferenceBinding", ")", "typeBinding", ")", ".", "isBinaryBinding", "(", ")", ";", "}", "else", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "{", "final", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "typeBinding", ";", "final", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "leafComponentType", "=", "arrayBinding", ".", "leafComponentType", ";", "if", "(", "leafComponentType", "instanceof", "ReferenceBinding", ")", "{", "return", "!", "(", "(", "ReferenceBinding", ")", "leafComponentType", ")", ".", "isBinaryBinding", "(", ")", ";", "}", "}", "}", "}", "else", "if", "(", "isCapture", "(", ")", ")", "{", "CaptureBinding", "captureBinding", "=", "(", "CaptureBinding", ")", "this", ".", "binding", ";", "return", "!", "captureBinding", ".", "sourceType", ".", "isBinaryBinding", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isInterface", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "TYPE_PARAMETER", ":", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "return", "false", ";", "}", "return", "this", ".", "binding", ".", "isInterface", "(", ")", ";", "}", "public", "boolean", "isLocal", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "referenceBinding", ".", "isLocalType", "(", ")", "&&", "!", "referenceBinding", ".", "isMemberType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isMember", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "referenceBinding", ".", "isMemberType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isNested", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "referenceBinding", ".", "isNestedType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isNullType", "(", ")", "{", "return", "this", ".", "binding", "==", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ".", "NULL", ";", "}", "public", "boolean", "isParameterizedType", "(", ")", "{", "return", "this", ".", "binding", ".", "isParameterizedTypeWithActualArguments", "(", ")", ";", "}", "public", "boolean", "isPrimitive", "(", ")", "{", "return", "!", "isNullType", "(", ")", "&&", "this", ".", "binding", ".", "isBaseType", "(", ")", ";", "}", "public", "boolean", "isRawType", "(", ")", "{", "return", "this", ".", "binding", ".", "isRawType", "(", ")", ";", "}", "public", "boolean", "isRecovered", "(", ")", "{", "return", "(", "this", ".", "binding", ".", "tagBits", "&", "TagBits", ".", "HasMissingType", ")", "!=", "0", ";", "}", "public", "boolean", "isSubTypeCompatible", "(", "ITypeBinding", "type", ")", "{", "try", "{", "if", "(", "this", "==", "type", ")", "return", "true", ";", "if", "(", "this", ".", "binding", ".", "isBaseType", "(", ")", ")", "return", "false", ";", "if", "(", "!", "(", "type", "instanceof", "TypeBinding", ")", ")", "return", "false", ";", "TypeBinding", "other", "=", "(", "TypeBinding", ")", "type", ";", "if", "(", "other", ".", "binding", ".", "isBaseType", "(", ")", ")", "return", "false", ";", "return", "this", ".", "binding", ".", "isCompatibleWith", "(", "other", ".", "binding", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "return", "false", ";", "}", "}", "public", "boolean", "isSynthetic", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isTopLevel", "(", ")", "{", "if", "(", "isClass", "(", ")", "||", "isInterface", "(", ")", "||", "isEnum", "(", ")", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "return", "!", "referenceBinding", ".", "isNestedType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isTypeVariable", "(", ")", "{", "return", "this", ".", "binding", ".", "isTypeVariable", "(", ")", "&&", "!", "this", ".", "binding", ".", "isCapture", "(", ")", ";", "}", "public", "boolean", "isUpperbound", "(", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "WILDCARD_TYPE", ":", "return", "(", "(", "WildcardBinding", ")", "this", ".", "binding", ")", ".", "boundKind", "==", "Wildcard", ".", "EXTENDS", ";", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "isWildcardType", "(", ")", "{", "return", "this", ".", "binding", ".", "isWildcard", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "binding", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,354
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ContinueStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "LABEL_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ContinueStatement", ".", "class", ",", "\"label\"", ",", "SimpleName", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "ContinueStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "LABEL_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "optionalLabel", "=", "null", ";", "ContinueStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "LABEL_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getLabel", "(", ")", ";", "}", "else", "{", "setLabel", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "CONTINUE_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ContinueStatement", "result", "=", "new", "ContinueStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setLabel", "(", "(", "SimpleName", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getLabel", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getLabel", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getLabel", "(", ")", "{", "return", "this", ".", "optionalLabel", ";", "}", "public", "void", "setLabel", "(", "SimpleName", "label", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalLabel", ";", "preReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "this", ".", "optionalLabel", "=", "label", ";", "postReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalLabel", "==", "null", "?", "0", ":", "getLabel", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,355
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ImportDeclaration", "extends", "ASTNode", "{", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ImportDeclaration", ".", "class", ",", "\"name\"", ",", "Name", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "ON_DEMAND_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "ImportDeclaration", ".", "class", ",", "\"onDemand\"", ",", "boolean", ".", "class", ",", "MANDATORY", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "STATIC_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "ImportDeclaration", ".", "class", ",", "\"static\"", ",", "boolean", ".", "class", ",", "MANDATORY", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "ImportDeclaration", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ON_DEMAND_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "ImportDeclaration", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "STATIC_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ON_DEMAND_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "Name", "importName", "=", "null", ";", "private", "boolean", "onDemand", "=", "false", ";", "private", "boolean", "isStatic", "=", "false", ";", "ImportDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "boolean", "internalGetSetBooleanProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "boolean", "value", ")", "{", "if", "(", "property", "==", "ON_DEMAND_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "isOnDemand", "(", ")", ";", "}", "else", "{", "setOnDemand", "(", "value", ")", ";", "return", "false", ";", "}", "}", "if", "(", "property", "==", "STATIC_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "isStatic", "(", ")", ";", "}", "else", "{", "setStatic", "(", "value", ")", ";", "return", "false", ";", "}", "}", "return", "super", ".", "internalGetSetBooleanProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "IMPORT_DECLARATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ImportDeclaration", "result", "=", "new", "ImportDeclaration", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setOnDemand", "(", "isOnDemand", "(", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "result", ".", "setStatic", "(", "isStatic", "(", ")", ")", ";", "}", "result", ".", "setName", "(", "(", "Name", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Name", "getName", "(", ")", "{", "if", "(", "this", ".", "importName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "importName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "importName", "=", "this", ".", "ast", ".", "newQualifiedName", "(", "new", "SimpleName", "(", "this", ".", "ast", ")", ",", "new", "SimpleName", "(", "this", ".", "ast", ")", ")", ";", "postLazyInit", "(", "this", ".", "importName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "importName", ";", "}", "public", "void", "setName", "(", "Name", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "importName", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "importName", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "public", "boolean", "isOnDemand", "(", ")", "{", "return", "this", ".", "onDemand", ";", "}", "public", "void", "setOnDemand", "(", "boolean", "onDemand", ")", "{", "preValueChange", "(", "ON_DEMAND_PROPERTY", ")", ";", "this", ".", "onDemand", "=", "onDemand", ";", "postValueChange", "(", "ON_DEMAND_PROPERTY", ")", ";", "}", "public", "boolean", "isStatic", "(", ")", "{", "unsupportedIn2", "(", ")", ";", "return", "this", ".", "isStatic", ";", "}", "public", "void", "setStatic", "(", "boolean", "isStatic", ")", "{", "unsupportedIn2", "(", ")", ";", "preValueChange", "(", "STATIC_PROPERTY", ")", ";", "this", ".", "isStatic", "=", "isStatic", ";", "postValueChange", "(", "STATIC_PROPERTY", ")", ";", "}", "public", "IBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveImport", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "importName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,356
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "SuperMethodInvocation", "extends", "Expression", "{", "public", "static", "final", "ChildPropertyDescriptor", "QUALIFIER_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "SuperMethodInvocation", ".", "class", ",", "\"qualifier\"", ",", "Name", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "TYPE_ARGUMENTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "SuperMethodInvocation", ".", "class", ",", "\"\"", ",", "Type", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "SuperMethodInvocation", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "ARGUMENTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "SuperMethodInvocation", ".", "class", ",", "\"arguments\"", ",", "Expression", ".", "class", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "SuperMethodInvocation", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "QUALIFIER_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "ARGUMENTS_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "propertyList", "=", "new", "ArrayList", "(", "5", ")", ";", "createPropertyList", "(", "SuperMethodInvocation", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "QUALIFIER_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_ARGUMENTS_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "ARGUMENTS_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "Name", "optionalQualifier", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "typeArguments", "=", "null", ";", "private", "SimpleName", "methodName", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "arguments", "=", "new", "ASTNode", ".", "NodeList", "(", "ARGUMENTS_PROPERTY", ")", ";", "SuperMethodInvocation", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "if", "(", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "this", ".", "typeArguments", "=", "new", "ASTNode", ".", "NodeList", "(", "TYPE_ARGUMENTS_PROPERTY", ")", ";", "}", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "QUALIFIER_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getQualifier", "(", ")", ";", "}", "else", "{", "setQualifier", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "ARGUMENTS_PROPERTY", ")", "{", "return", "arguments", "(", ")", ";", "}", "if", "(", "property", "==", "TYPE_ARGUMENTS_PROPERTY", ")", "{", "return", "typeArguments", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "SUPER_METHOD_INVOCATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "SuperMethodInvocation", "result", "=", "new", "SuperMethodInvocation", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setQualifier", "(", "(", "Name", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getQualifier", "(", ")", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "result", ".", "typeArguments", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "typeArguments", "(", ")", ")", ")", ";", "}", "result", ".", "arguments", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "arguments", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getQualifier", "(", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "typeArguments", ")", ";", "}", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "arguments", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Name", "getQualifier", "(", ")", "{", "return", "this", ".", "optionalQualifier", ";", "}", "public", "boolean", "isResolvedTypeInferredFromExpectedType", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "isResolvedTypeInferredFromExpectedType", "(", "this", ")", ";", "}", "public", "void", "setQualifier", "(", "Name", "name", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalQualifier", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "QUALIFIER_PROPERTY", ")", ";", "this", ".", "optionalQualifier", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "QUALIFIER_PROPERTY", ")", ";", "}", "public", "List", "typeArguments", "(", ")", "{", "if", "(", "this", ".", "typeArguments", "==", "null", ")", "{", "unsupportedIn2", "(", ")", ";", "}", "return", "this", ".", "typeArguments", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "methodName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "methodName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "methodName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "methodName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "methodName", ";", "}", "public", "void", "setName", "(", "SimpleName", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "methodName", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "methodName", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "public", "List", "arguments", "(", ")", "{", "return", "this", ".", "arguments", ";", "}", "public", "IMethodBinding", "resolveMethodBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveMethod", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "4", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalQualifier", "==", "null", "?", "0", ":", "getQualifier", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "typeArguments", "==", "null", "?", "0", ":", "this", ".", "typeArguments", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "methodName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "arguments", "==", "null", "?", "0", ":", "this", ".", "arguments", ".", "listSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,357
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "QualifiedType", "extends", "Type", "{", "int", "index", ";", "public", "static", "final", "ChildPropertyDescriptor", "QUALIFIER_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "QualifiedType", ".", "class", ",", "\"qualifier\"", ",", "Type", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "QualifiedType", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "QualifiedType", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "QUALIFIER_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Type", "qualifier", "=", "null", ";", "private", "SimpleName", "name", "=", "null", ";", "QualifiedType", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "QUALIFIER_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getQualifier", "(", ")", ";", "}", "else", "{", "setQualifier", "(", "(", "Type", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "QUALIFIED_TYPE", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "QualifiedType", "result", "=", "new", "QualifiedType", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setQualifier", "(", "(", "Type", ")", "(", "(", "ASTNode", ")", "getQualifier", "(", ")", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "(", "(", "ASTNode", ")", "getName", "(", ")", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getQualifier", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Type", "getQualifier", "(", ")", "{", "if", "(", "this", ".", "qualifier", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "qualifier", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "qualifier", "=", "new", "SimpleType", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "qualifier", ",", "QUALIFIER_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "qualifier", ";", "}", "public", "void", "setQualifier", "(", "Type", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "qualifier", ";", "preReplaceChild", "(", "oldChild", ",", "type", ",", "QUALIFIER_PROPERTY", ")", ";", "this", ".", "qualifier", "=", "type", ";", "postReplaceChild", "(", "oldChild", ",", "type", ",", "QUALIFIER_PROPERTY", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "name", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "name", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "name", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "name", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "name", ";", "}", "public", "void", "setName", "(", "SimpleName", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "name", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "name", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "qualifier", "==", "null", "?", "0", ":", "getQualifier", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "name", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,358
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "Initializer", "extends", "BodyDeclaration", "{", "public", "static", "final", "ChildPropertyDescriptor", "JAVADOC_PROPERTY", "=", "internalJavadocPropertyFactory", "(", "Initializer", ".", "class", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "MODIFIERS_PROPERTY", "=", "internalModifiersPropertyFactory", "(", "Initializer", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "MODIFIERS2_PROPERTY", "=", "internalModifiers2PropertyFactory", "(", "Initializer", ".", "class", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "BODY_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "Initializer", ".", "class", ",", "\"body\"", ",", "Block", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "Initializer", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "MODIFIERS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "Initializer", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "MODIFIERS2_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "Block", "body", "=", "null", ";", "Initializer", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "int", "internalGetSetIntProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "int", "value", ")", "{", "if", "(", "property", "==", "MODIFIERS_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getModifiers", "(", ")", ";", "}", "else", "{", "internalSetModifiers", "(", "value", ")", ";", "return", "0", ";", "}", "}", "return", "super", ".", "internalGetSetIntProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "JAVADOC_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getJavadoc", "(", ")", ";", "}", "else", "{", "setJavadoc", "(", "(", "Javadoc", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "BODY_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getBody", "(", ")", ";", "}", "else", "{", "setBody", "(", "(", "Block", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "MODIFIERS2_PROPERTY", ")", "{", "return", "modifiers", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalJavadocProperty", "(", ")", "{", "return", "JAVADOC_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalModifiers2Property", "(", ")", "{", "return", "MODIFIERS2_PROPERTY", ";", "}", "final", "SimplePropertyDescriptor", "internalModifiersProperty", "(", ")", "{", "return", "MODIFIERS_PROPERTY", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "INITIALIZER", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "Initializer", "result", "=", "new", "Initializer", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "result", ".", "internalSetModifiers", "(", "getModifiers", "(", ")", ")", ";", "}", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "result", ".", "modifiers", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "modifiers", "(", ")", ")", ")", ";", "}", "result", ".", "setJavadoc", "(", "(", "Javadoc", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getJavadoc", "(", ")", ")", ")", ";", "result", ".", "setBody", "(", "(", "Block", ")", "getBody", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getJavadoc", "(", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "modifiers", ")", ";", "}", "acceptChild", "(", "visitor", ",", "getBody", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Block", "getBody", "(", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "body", "=", "new", "Block", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "body", ",", "BODY_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "body", ";", "}", "public", "void", "setBody", "(", "Block", "body", ")", "{", "if", "(", "body", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "body", ";", "preReplaceChild", "(", "oldChild", ",", "body", ",", "BODY_PROPERTY", ")", ";", "this", ".", "body", "=", "body", ";", "postReplaceChild", "(", "oldChild", ",", "body", ",", "BODY_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalDocComment", "==", "null", "?", "0", ":", "getJavadoc", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "modifiers", "==", "null", "?", "0", ":", "this", ".", "modifiers", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "body", "==", "null", "?", "0", ":", "getBody", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,359
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "interface", "IDocElement", "{", "}", "</s>" ]
2,360
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "Comment", "extends", "ASTNode", "{", "private", "ASTNode", "alternateRoot", "=", "null", ";", "Comment", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "public", "final", "boolean", "isBlockComment", "(", ")", "{", "return", "(", "this", "instanceof", "BlockComment", ")", ";", "}", "public", "final", "boolean", "isLineComment", "(", ")", "{", "return", "(", "this", "instanceof", "LineComment", ")", ";", "}", "public", "final", "boolean", "isDocComment", "(", ")", "{", "return", "(", "this", "instanceof", "Javadoc", ")", ";", "}", "public", "final", "ASTNode", "getAlternateRoot", "(", ")", "{", "return", "this", ".", "alternateRoot", ";", "}", "public", "final", "void", "setAlternateRoot", "(", "ASTNode", "root", ")", "{", "checkModifiable", "(", ")", ";", "this", ".", "alternateRoot", "=", "root", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "1", "*", "4", ";", "}", "}", "</s>" ]
2,361
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "PrefixExpression", "extends", "Expression", "{", "public", "static", "class", "Operator", "{", "private", "String", "token", ";", "private", "Operator", "(", "String", "token", ")", "{", "this", ".", "token", "=", "token", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "token", ";", "}", "public", "static", "final", "Operator", "INCREMENT", "=", "new", "Operator", "(", "\"++\"", ")", ";", "public", "static", "final", "Operator", "DECREMENT", "=", "new", "Operator", "(", "\"--\"", ")", ";", "public", "static", "final", "Operator", "PLUS", "=", "new", "Operator", "(", "\"+\"", ")", ";", "public", "static", "final", "Operator", "MINUS", "=", "new", "Operator", "(", "\"-\"", ")", ";", "public", "static", "final", "Operator", "COMPLEMENT", "=", "new", "Operator", "(", "\"~\"", ")", ";", "public", "static", "final", "Operator", "NOT", "=", "new", "Operator", "(", "\"!\"", ")", ";", "private", "static", "final", "Map", "CODES", ";", "static", "{", "CODES", "=", "new", "HashMap", "(", "20", ")", ";", "Operator", "[", "]", "ops", "=", "{", "INCREMENT", ",", "DECREMENT", ",", "PLUS", ",", "MINUS", ",", "COMPLEMENT", ",", "NOT", ",", "}", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ops", ".", "length", ";", "i", "++", ")", "{", "CODES", ".", "put", "(", "ops", "[", "i", "]", ".", "toString", "(", ")", ",", "ops", "[", "i", "]", ")", ";", "}", "}", "public", "static", "Operator", "toOperator", "(", "String", "token", ")", "{", "return", "(", "Operator", ")", "CODES", ".", "get", "(", "token", ")", ";", "}", "}", "public", "static", "final", "SimplePropertyDescriptor", "OPERATOR_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "PrefixExpression", ".", "class", ",", "\"operator\"", ",", "PrefixExpression", ".", "Operator", ".", "class", ",", "MANDATORY", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "OPERAND_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "PrefixExpression", ".", "class", ",", "\"operand\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "PrefixExpression", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "OPERATOR_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "OPERAND_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "PrefixExpression", ".", "Operator", "operator", "=", "PrefixExpression", ".", "Operator", ".", "PLUS", ";", "private", "Expression", "operand", "=", "null", ";", "PrefixExpression", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "Object", "internalGetSetObjectProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "Object", "value", ")", "{", "if", "(", "property", "==", "OPERATOR_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getOperator", "(", ")", ";", "}", "else", "{", "setOperator", "(", "(", "Operator", ")", "value", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetObjectProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "OPERAND_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getOperand", "(", ")", ";", "}", "else", "{", "setOperand", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "PREFIX_EXPRESSION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "PrefixExpression", "result", "=", "new", "PrefixExpression", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setOperator", "(", "getOperator", "(", ")", ")", ";", "result", ".", "setOperand", "(", "(", "Expression", ")", "getOperand", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getOperand", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "PrefixExpression", ".", "Operator", "getOperator", "(", ")", "{", "return", "this", ".", "operator", ";", "}", "public", "void", "setOperator", "(", "PrefixExpression", ".", "Operator", "operator", ")", "{", "if", "(", "operator", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "preValueChange", "(", "OPERATOR_PROPERTY", ")", ";", "this", ".", "operator", "=", "operator", ";", "postValueChange", "(", "OPERATOR_PROPERTY", ")", ";", "}", "public", "Expression", "getOperand", "(", ")", "{", "if", "(", "this", ".", "operand", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "operand", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "operand", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "operand", ",", "OPERAND_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "operand", ";", "}", "public", "void", "setOperand", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "operand", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "OPERAND_PROPERTY", ")", ";", "this", ".", "operand", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "OPERAND_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "operand", "==", "null", "?", "0", ":", "getOperand", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,362
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "ASTVisitor", "{", "private", "boolean", "visitDocTags", ";", "public", "ASTVisitor", "(", ")", "{", "this", "(", "false", ")", ";", "}", "public", "ASTVisitor", "(", "boolean", "visitDocTags", ")", "{", "this", ".", "visitDocTags", "=", "visitDocTags", ";", "}", "public", "void", "preVisit", "(", "ASTNode", "node", ")", "{", "}", "public", "boolean", "preVisit2", "(", "ASTNode", "node", ")", "{", "preVisit", "(", "node", ")", ";", "return", "true", ";", "}", "public", "void", "postVisit", "(", "ASTNode", "node", ")", "{", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeMemberDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ArrayAccess", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ArrayCreation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ArrayInitializer", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ArrayType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AssertStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Assignment", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Block", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "BlockComment", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "BooleanLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "BreakStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "CastExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "CatchClause", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "CharacterLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ClassInstanceCreation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "CompilationUnit", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ConditionalExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ConstructorInvocation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ContinueStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "DoStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EmptyStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EnhancedForStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EnumConstantDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ExpressionStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "FieldAccess", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ForStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "IfStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ImportDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "InfixExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "InstanceofExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Initializer", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Javadoc", "node", ")", "{", "return", "this", ".", "visitDocTags", ";", "}", "public", "boolean", "visit", "(", "LabeledStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "LineComment", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MarkerAnnotation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MemberRef", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MemberValuePair", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MethodRef", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MethodRefParameter", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MethodInvocation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "Modifier", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "NormalAnnotation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "NullLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "NumberLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "PackageDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ParameterizedType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ParenthesizedExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "PostfixExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "PrefixExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "PrimitiveType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "QualifiedName", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "QualifiedType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ReturnStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SimpleName", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SimpleType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SingleMemberAnnotation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SingleVariableDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "StringLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SuperConstructorInvocation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SuperFieldAccess", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SuperMethodInvocation", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SwitchCase", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SwitchStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SynchronizedStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TagElement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TextElement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ThisExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "ThrowStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TryStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclarationStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeLiteral", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeParameter", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "UnionType", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationExpression", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "VariableDeclarationFragment", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "WhileStatement", "node", ")", "{", "return", "true", ";", "}", "public", "boolean", "visit", "(", "WildcardType", "node", ")", "{", "return", "true", ";", "}", "public", "void", "endVisit", "(", "AnnotationTypeDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "AnnotationTypeMemberDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "AnonymousClassDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ArrayAccess", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ArrayCreation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ArrayInitializer", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ArrayType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "AssertStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "Assignment", "node", ")", "{", "}", "public", "void", "endVisit", "(", "Block", "node", ")", "{", "}", "public", "void", "endVisit", "(", "BlockComment", "node", ")", "{", "}", "public", "void", "endVisit", "(", "BooleanLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "BreakStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "CastExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "CatchClause", "node", ")", "{", "}", "public", "void", "endVisit", "(", "CharacterLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ClassInstanceCreation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "CompilationUnit", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ConditionalExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ConstructorInvocation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ContinueStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "DoStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "EmptyStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "EnhancedForStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "EnumConstantDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "EnumDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ExpressionStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "FieldAccess", "node", ")", "{", "}", "public", "void", "endVisit", "(", "FieldDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ForStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "IfStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ImportDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "InfixExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "InstanceofExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "Initializer", "node", ")", "{", "}", "public", "void", "endVisit", "(", "Javadoc", "node", ")", "{", "}", "public", "void", "endVisit", "(", "LabeledStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "LineComment", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MarkerAnnotation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MemberRef", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MemberValuePair", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MethodRef", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MethodRefParameter", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MethodDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "MethodInvocation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "Modifier", "node", ")", "{", "}", "public", "void", "endVisit", "(", "NormalAnnotation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "NullLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "NumberLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "PackageDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ParameterizedType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ParenthesizedExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "PostfixExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "PrefixExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "PrimitiveType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "QualifiedName", "node", ")", "{", "}", "public", "void", "endVisit", "(", "QualifiedType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ReturnStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SimpleName", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SimpleType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SingleMemberAnnotation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SingleVariableDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "StringLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SuperConstructorInvocation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SuperFieldAccess", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SuperMethodInvocation", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SwitchCase", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SwitchStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "SynchronizedStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TagElement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TextElement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ThisExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "ThrowStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TryStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TypeDeclaration", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TypeDeclarationStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TypeLiteral", "node", ")", "{", "}", "public", "void", "endVisit", "(", "TypeParameter", "node", ")", "{", "}", "public", "void", "endVisit", "(", "UnionType", "node", ")", "{", "}", "public", "void", "endVisit", "(", "VariableDeclarationExpression", "node", ")", "{", "}", "public", "void", "endVisit", "(", "VariableDeclarationStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "VariableDeclarationFragment", "node", ")", "{", "}", "public", "void", "endVisit", "(", "WhileStatement", "node", ")", "{", "}", "public", "void", "endVisit", "(", "WildcardType", "node", ")", "{", "}", "}", "</s>" ]
2,363
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "List", ";", "public", "abstract", "class", "AbstractTypeDeclaration", "extends", "BodyDeclaration", "{", "SimpleName", "typeName", "=", "null", ";", "ASTNode", ".", "NodeList", "bodyDeclarations", ";", "abstract", "ChildListPropertyDescriptor", "internalBodyDeclarationsProperty", "(", ")", ";", "public", "final", "ChildListPropertyDescriptor", "getBodyDeclarationsProperty", "(", ")", "{", "return", "internalBodyDeclarationsProperty", "(", ")", ";", "}", "abstract", "ChildPropertyDescriptor", "internalNameProperty", "(", ")", ";", "public", "final", "ChildPropertyDescriptor", "getNameProperty", "(", ")", "{", "return", "internalNameProperty", "(", ")", ";", "}", "static", "final", "ChildListPropertyDescriptor", "internalBodyDeclarationPropertyFactory", "(", "Class", "nodeClass", ")", "{", "return", "new", "ChildListPropertyDescriptor", "(", "nodeClass", ",", "\"\"", ",", "BodyDeclaration", ".", "class", ",", "CYCLE_RISK", ")", ";", "}", "static", "final", "ChildPropertyDescriptor", "internalNamePropertyFactory", "(", "Class", "nodeClass", ")", "{", "return", "new", "ChildPropertyDescriptor", "(", "nodeClass", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "}", "AbstractTypeDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "this", ".", "bodyDeclarations", "=", "new", "ASTNode", ".", "NodeList", "(", "internalBodyDeclarationsProperty", "(", ")", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "typeName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "typeName", ",", "internalNameProperty", "(", ")", ")", ";", "}", "}", "}", "return", "this", ".", "typeName", ";", "}", "public", "void", "setName", "(", "SimpleName", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ChildPropertyDescriptor", "p", "=", "internalNameProperty", "(", ")", ";", "ASTNode", "oldChild", "=", "this", ".", "typeName", ";", "preReplaceChild", "(", "oldChild", ",", "typeName", ",", "p", ")", ";", "this", ".", "typeName", "=", "typeName", ";", "postReplaceChild", "(", "oldChild", ",", "typeName", ",", "p", ")", ";", "}", "public", "List", "bodyDeclarations", "(", ")", "{", "return", "this", ".", "bodyDeclarations", ";", "}", "public", "boolean", "isPackageMemberTypeDeclaration", "(", ")", "{", "ASTNode", "parent", "=", "getParent", "(", ")", ";", "return", "(", "parent", "instanceof", "CompilationUnit", ")", ";", "}", "public", "boolean", "isMemberTypeDeclaration", "(", ")", "{", "ASTNode", "parent", "=", "getParent", "(", ")", ";", "return", "(", "parent", "instanceof", "AbstractTypeDeclaration", ")", "||", "(", "parent", "instanceof", "AnonymousClassDeclaration", ")", ";", "}", "public", "boolean", "isLocalTypeDeclaration", "(", ")", "{", "ASTNode", "parent", "=", "getParent", "(", ")", ";", "return", "(", "parent", "instanceof", "TypeDeclarationStatement", ")", ";", "}", "public", "final", "ITypeBinding", "resolveBinding", "(", ")", "{", "return", "internalResolveBinding", "(", ")", ";", "}", "abstract", "ITypeBinding", "internalResolveBinding", "(", ")", ";", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "2", "*", "4", ";", "}", "}", "</s>" ]
2,364
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ToolFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IScanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "ITerminalSymbols", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "public", "final", "class", "NodeFinder", "{", "private", "static", "class", "NodeFinderVisitor", "extends", "ASTVisitor", "{", "private", "int", "fStart", ";", "private", "int", "fEnd", ";", "private", "ASTNode", "fCoveringNode", ";", "private", "ASTNode", "fCoveredNode", ";", "NodeFinderVisitor", "(", "int", "offset", ",", "int", "length", ")", "{", "super", "(", "true", ")", ";", "this", ".", "fStart", "=", "offset", ";", "this", ".", "fEnd", "=", "offset", "+", "length", ";", "}", "public", "boolean", "preVisit2", "(", "ASTNode", "node", ")", "{", "int", "nodeStart", "=", "node", ".", "getStartPosition", "(", ")", ";", "int", "nodeEnd", "=", "nodeStart", "+", "node", ".", "getLength", "(", ")", ";", "if", "(", "nodeEnd", "<", "this", ".", "fStart", "||", "this", ".", "fEnd", "<", "nodeStart", ")", "{", "return", "false", ";", "}", "if", "(", "nodeStart", "<=", "this", ".", "fStart", "&&", "this", ".", "fEnd", "<=", "nodeEnd", ")", "{", "this", ".", "fCoveringNode", "=", "node", ";", "}", "if", "(", "this", ".", "fStart", "<=", "nodeStart", "&&", "nodeEnd", "<=", "this", ".", "fEnd", ")", "{", "if", "(", "this", ".", "fCoveringNode", "==", "node", ")", "{", "this", ".", "fCoveredNode", "=", "node", ";", "return", "true", ";", "}", "else", "if", "(", "this", ".", "fCoveredNode", "==", "null", ")", "{", "this", ".", "fCoveredNode", "=", "node", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}", "public", "ASTNode", "getCoveredNode", "(", ")", "{", "return", "this", ".", "fCoveredNode", ";", "}", "public", "ASTNode", "getCoveringNode", "(", ")", "{", "return", "this", ".", "fCoveringNode", ";", "}", "}", "public", "static", "ASTNode", "perform", "(", "ASTNode", "root", ",", "int", "start", ",", "int", "length", ")", "{", "NodeFinder", "finder", "=", "new", "NodeFinder", "(", "root", ",", "start", ",", "length", ")", ";", "ASTNode", "result", "=", "finder", ".", "getCoveredNode", "(", ")", ";", "if", "(", "result", "==", "null", "||", "result", ".", "getStartPosition", "(", ")", "!=", "start", "||", "result", ".", "getLength", "(", ")", "!=", "length", ")", "{", "return", "finder", ".", "getCoveringNode", "(", ")", ";", "}", "return", "result", ";", "}", "public", "static", "ASTNode", "perform", "(", "ASTNode", "root", ",", "ISourceRange", "range", ")", "{", "return", "perform", "(", "root", ",", "range", ".", "getOffset", "(", ")", ",", "range", ".", "getLength", "(", ")", ")", ";", "}", "public", "static", "ASTNode", "perform", "(", "ASTNode", "root", ",", "int", "start", ",", "int", "length", ",", "ITypeRoot", "source", ")", "throws", "JavaModelException", "{", "NodeFinder", "finder", "=", "new", "NodeFinder", "(", "root", ",", "start", ",", "length", ")", ";", "ASTNode", "result", "=", "finder", ".", "getCoveredNode", "(", ")", ";", "if", "(", "result", "==", "null", ")", "return", "null", ";", "int", "nodeStart", "=", "result", ".", "getStartPosition", "(", ")", ";", "if", "(", "start", "<=", "nodeStart", "&&", "(", "(", "nodeStart", "+", "result", ".", "getLength", "(", ")", ")", "<=", "(", "start", "+", "length", ")", ")", ")", "{", "IBuffer", "buffer", "=", "source", ".", "getBuffer", "(", ")", ";", "if", "(", "buffer", "!=", "null", ")", "{", "IScanner", "scanner", "=", "ToolFactory", ".", "createScanner", "(", "false", ",", "false", ",", "false", ",", "false", ")", ";", "try", "{", "scanner", ".", "setSource", "(", "buffer", ".", "getText", "(", "start", ",", "length", ")", ".", "toCharArray", "(", ")", ")", ";", "int", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "if", "(", "token", "!=", "ITerminalSymbols", ".", "TokenNameEOF", ")", "{", "int", "tStart", "=", "scanner", ".", "getCurrentTokenStartPosition", "(", ")", ";", "if", "(", "tStart", "==", "result", ".", "getStartPosition", "(", ")", "-", "start", ")", "{", "scanner", ".", "resetTo", "(", "tStart", "+", "result", ".", "getLength", "(", ")", ",", "length", "-", "1", ")", ";", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "if", "(", "token", "==", "ITerminalSymbols", ".", "TokenNameEOF", ")", "return", "result", ";", "}", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "return", "null", ";", "}", "}", "}", "return", "finder", ".", "getCoveringNode", "(", ")", ";", "}", "private", "ASTNode", "fCoveringNode", ";", "private", "ASTNode", "fCoveredNode", ";", "public", "NodeFinder", "(", "ASTNode", "root", ",", "int", "start", ",", "int", "length", ")", "{", "NodeFinderVisitor", "nodeFinderVisitor", "=", "new", "NodeFinderVisitor", "(", "start", ",", "length", ")", ";", "root", ".", "accept", "(", "nodeFinderVisitor", ")", ";", "this", ".", "fCoveredNode", "=", "nodeFinderVisitor", ".", "getCoveredNode", "(", ")", ";", "this", ".", "fCoveringNode", "=", "nodeFinderVisitor", ".", "getCoveringNode", "(", ")", ";", "}", "public", "ASTNode", "getCoveredNode", "(", ")", "{", "return", "this", ".", "fCoveredNode", ";", "}", "public", "ASTNode", "getCoveringNode", "(", ")", "{", "return", "this", ".", "fCoveringNode", ";", "}", "}", "</s>" ]
2,365
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "final", "class", "MarkerAnnotation", "extends", "Annotation", "{", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_NAME_PROPERTY", "=", "internalTypeNamePropertyFactory", "(", "MarkerAnnotation", ".", "class", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "MarkerAnnotation", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_NAME_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "MarkerAnnotation", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "TYPE_NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getTypeName", "(", ")", ";", "}", "else", "{", "setTypeName", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalTypeNameProperty", "(", ")", "{", "return", "TYPE_NAME_PROPERTY", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "MARKER_ANNOTATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "MarkerAnnotation", "result", "=", "new", "MarkerAnnotation", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setTypeName", "(", "(", "Name", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getTypeName", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getTypeName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getTypeName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,366
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "public", "class", "NumberLiteral", "extends", "Expression", "{", "public", "static", "final", "SimplePropertyDescriptor", "TOKEN_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "NumberLiteral", ".", "class", ",", "\"token\"", ",", "String", ".", "class", ",", "MANDATORY", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "NumberLiteral", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "TOKEN_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "String", "tokenValue", "=", "\"0\"", ";", "NumberLiteral", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "Object", "internalGetSetObjectProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "Object", "value", ")", "{", "if", "(", "property", "==", "TOKEN_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getToken", "(", ")", ";", "}", "else", "{", "setToken", "(", "(", "String", ")", "value", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetObjectProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "NUMBER_LITERAL", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "NumberLiteral", "result", "=", "new", "NumberLiteral", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setToken", "(", "getToken", "(", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "visitor", ".", "visit", "(", "this", ")", ";", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "String", "getToken", "(", ")", "{", "return", "this", ".", "tokenValue", ";", "}", "public", "void", "setToken", "(", "String", "token", ")", "{", "if", "(", "token", "==", "null", "||", "token", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "Scanner", "scanner", "=", "this", ".", "ast", ".", "scanner", ";", "char", "[", "]", "source", "=", "token", ".", "toCharArray", "(", ")", ";", "scanner", ".", "setSource", "(", "source", ")", ";", "scanner", ".", "resetTo", "(", "0", ",", "source", ".", "length", ")", ";", "scanner", ".", "tokenizeComments", "=", "false", ";", "scanner", ".", "tokenizeWhiteSpace", "=", "false", ";", "try", "{", "int", "tokenType", "=", "scanner", ".", "getNextToken", "(", ")", ";", "switch", "(", "tokenType", ")", "{", "case", "TerminalTokens", ".", "TokenNameDoubleLiteral", ":", "case", "TerminalTokens", ".", "TokenNameIntegerLiteral", ":", "case", "TerminalTokens", ".", "TokenNameFloatingPointLiteral", ":", "case", "TerminalTokens", ".", "TokenNameLongLiteral", ":", "break", ";", "case", "TerminalTokens", ".", "TokenNameMINUS", ":", "tokenType", "=", "scanner", ".", "getNextToken", "(", ")", ";", "switch", "(", "tokenType", ")", "{", "case", "TerminalTokens", ".", "TokenNameDoubleLiteral", ":", "case", "TerminalTokens", ".", "TokenNameIntegerLiteral", ":", "case", "TerminalTokens", ".", "TokenNameFloatingPointLiteral", ":", "case", "TerminalTokens", ".", "TokenNameLongLiteral", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "token", "+", "\"<\"", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "token", "+", "\"<\"", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "finally", "{", "scanner", ".", "tokenizeComments", "=", "true", ";", "scanner", ".", "tokenizeWhiteSpace", "=", "true", ";", "}", "preValueChange", "(", "TOKEN_PROPERTY", ")", ";", "this", ".", "tokenValue", "=", "token", ";", "postValueChange", "(", "TOKEN_PROPERTY", ")", ";", "}", "void", "internalSetToken", "(", "String", "token", ")", "{", "preValueChange", "(", "TOKEN_PROPERTY", ")", ";", "this", ".", "tokenValue", "=", "token", ";", "postValueChange", "(", "TOKEN_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "int", "size", "=", "BASE_NODE_SIZE", "+", "1", "*", "4", "+", "stringSize", "(", "this", ".", "tokenValue", ")", ";", "return", "size", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", ";", "}", "}", "</s>" ]
2,367
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "DoStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "DoStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "BODY_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "DoStatement", ".", "class", ",", "\"body\"", ",", "Statement", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "DoStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "expression", "=", "null", ";", "private", "Statement", "body", "=", "null", ";", "DoStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "BODY_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getBody", "(", ")", ";", "}", "else", "{", "setBody", "(", "(", "Statement", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "DO_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "DoStatement", "result", "=", "new", "DoStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "getExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setBody", "(", "(", "Statement", ")", "getBody", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getBody", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "expression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "expression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "expression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "expression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "Statement", "getBody", "(", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "body", "=", "new", "Block", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "body", ",", "BODY_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "body", ";", "}", "public", "void", "setBody", "(", "Statement", "statement", ")", "{", "if", "(", "statement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "body", ";", "preReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "this", ".", "body", "=", "statement", ";", "postReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "expression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "body", "==", "null", "?", "0", ":", "getBody", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,368
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "public", "final", "class", "TextElement", "extends", "ASTNode", "implements", "IDocElement", "{", "public", "static", "final", "SimplePropertyDescriptor", "TEXT_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "TextElement", ".", "class", ",", "\"text\"", ",", "String", ".", "class", ",", "MANDATORY", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "TextElement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "TEXT_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "String", "text", "=", "Util", ".", "EMPTY_STRING", ";", "TextElement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "Object", "internalGetSetObjectProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "Object", "value", ")", "{", "if", "(", "property", "==", "TEXT_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getText", "(", ")", ";", "}", "else", "{", "setText", "(", "(", "String", ")", "value", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetObjectProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "TEXT_ELEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "TextElement", "result", "=", "new", "TextElement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setText", "(", "getText", "(", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "visitor", ".", "visit", "(", "this", ")", ";", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "this", ".", "text", ";", "}", "public", "void", "setText", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "text", ".", "indexOf", "(", "\"*/\"", ")", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "preValueChange", "(", "TEXT_PROPERTY", ")", ";", "this", ".", "text", "=", "text", ";", "postValueChange", "(", "TEXT_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "int", "size", "=", "BASE_NODE_SIZE", "+", "1", "*", "4", ";", "if", "(", "this", ".", "text", "!=", "Util", ".", "EMPTY_STRING", ")", "{", "size", "+=", "stringSize", "(", "this", ".", "text", ")", ";", "}", "return", "size", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", ";", "}", "}", "</s>" ]
2,369
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "Constant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ElementValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeIds", ";", "class", "MemberValuePairBinding", "implements", "IMemberValuePairBinding", "{", "static", "final", "MemberValuePairBinding", "[", "]", "NoPair", "=", "new", "MemberValuePairBinding", "[", "0", "]", ";", "private", "static", "final", "Object", "NoValue", "=", "new", "Object", "(", ")", ";", "private", "static", "final", "Object", "[", "]", "EmptyArray", "=", "new", "Object", "[", "0", "]", ";", "private", "ElementValuePair", "internalPair", ";", "protected", "Object", "value", "=", "null", ";", "protected", "BindingResolver", "bindingResolver", ";", "static", "void", "appendValue", "(", "Object", "value", ",", "StringBuffer", "buffer", ")", "{", "if", "(", "value", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "values", "=", "(", "Object", "[", "]", ")", "value", ";", "buffer", ".", "append", "(", "'{'", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "values", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "appendValue", "(", "values", "[", "i", "]", ",", "buffer", ")", ";", "}", "buffer", ".", "append", "(", "'}'", ")", ";", "}", "else", "if", "(", "value", "instanceof", "ITypeBinding", ")", "{", "buffer", ".", "append", "(", "(", "(", "ITypeBinding", ")", "value", ")", ".", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "\".class\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "value", ")", ";", "}", "}", "static", "Object", "buildDOMValue", "(", "final", "Object", "internalObject", ",", "BindingResolver", "resolver", ")", "{", "if", "(", "internalObject", "==", "null", ")", "return", "null", ";", "if", "(", "internalObject", "instanceof", "Constant", ")", "{", "Constant", "constant", "=", "(", "Constant", ")", "internalObject", ";", "switch", "(", "constant", ".", "typeID", "(", ")", ")", "{", "case", "TypeIds", ".", "T_boolean", ":", "return", "Boolean", ".", "valueOf", "(", "constant", ".", "booleanValue", "(", ")", ")", ";", "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", "(", ")", ")", ";", "default", ":", "return", "constant", ".", "stringValue", "(", ")", ";", "}", "}", "else", "if", "(", "internalObject", "instanceof", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ")", "{", "return", "resolver", ".", "getTypeBinding", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ")", "internalObject", ")", ";", "}", "else", "if", "(", "internalObject", "instanceof", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", ")", "{", "return", "resolver", ".", "getAnnotationInstance", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", ")", "internalObject", ")", ";", "}", "else", "if", "(", "internalObject", "instanceof", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "FieldBinding", ")", "{", "return", "resolver", ".", "getVariableBinding", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "FieldBinding", ")", "internalObject", ")", ";", "}", "else", "if", "(", "internalObject", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "elements", "=", "(", "Object", "[", "]", ")", "internalObject", ";", "int", "length", "=", "elements", ".", "length", ";", "Object", "[", "]", "values", "=", "length", "==", "0", "?", "EmptyArray", ":", "new", "Object", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "values", "[", "i", "]", "=", "buildDOMValue", "(", "elements", "[", "i", "]", ",", "resolver", ")", ";", "return", "values", ";", "}", "return", "null", ";", "}", "MemberValuePairBinding", "(", "ElementValuePair", "pair", ",", "BindingResolver", "resolver", ")", "{", "this", ".", "internalPair", "=", "pair", ";", "this", ".", "bindingResolver", "=", "resolver", ";", "}", "public", "IAnnotationBinding", "[", "]", "getAnnotations", "(", ")", "{", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "return", "null", ";", "}", "public", "String", "getKey", "(", ")", "{", "return", "null", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "IBinding", ".", "MEMBER_VALUE_PAIR", ";", "}", "public", "IMethodBinding", "getMethodBinding", "(", ")", "{", "return", "this", ".", "bindingResolver", ".", "getMethodBinding", "(", "this", ".", "internalPair", ".", "getMethodBinding", "(", ")", ")", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "Modifier", ".", "NONE", ";", "}", "public", "String", "getName", "(", ")", "{", "if", "(", "this", ".", "internalPair", "==", "null", ")", "return", "null", ";", "final", "char", "[", "]", "membername", "=", "this", ".", "internalPair", ".", "getName", "(", ")", ";", "return", "membername", "==", "null", "?", "null", ":", "new", "String", "(", "membername", ")", ";", "}", "public", "Object", "getValue", "(", ")", "{", "if", "(", "this", ".", "value", "==", "null", ")", "init", "(", ")", ";", "return", "this", ".", "value", "==", "NoValue", "?", "null", ":", "this", ".", "value", ";", "}", "private", "void", "init", "(", ")", "{", "this", ".", "value", "=", "buildDOMValue", "(", "this", ".", "internalPair", ".", "getValue", "(", ")", ",", "this", ".", "bindingResolver", ")", ";", "if", "(", "this", ".", "value", "==", "null", ")", "this", ".", "value", "=", "NoValue", ";", "IMethodBinding", "methodBinding", "=", "getMethodBinding", "(", ")", ";", "if", "(", "methodBinding", ".", "getReturnType", "(", ")", ".", "isArray", "(", ")", "&&", "!", "this", ".", "value", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "this", ".", "value", "=", "new", "Object", "[", "]", "{", "this", ".", "value", "}", ";", "}", "}", "char", "[", "]", "internalName", "(", ")", "{", "return", "this", ".", "internalPair", "==", "null", "?", "null", ":", "this", ".", "internalPair", ".", "getName", "(", ")", ";", "}", "public", "boolean", "isDefault", "(", ")", "{", "Object", "value2", "=", "getValue", "(", ")", ";", "Object", "defaultValue", "=", "getMethodBinding", "(", ")", ".", "getDefaultValue", "(", ")", ";", "if", "(", "value2", "instanceof", "IBinding", ")", "{", "if", "(", "defaultValue", "instanceof", "IBinding", ")", "{", "return", "(", "(", "IBinding", ")", "value2", ")", ".", "isEqualTo", "(", "(", "IBinding", ")", "defaultValue", ")", ";", "}", "return", "false", ";", "}", "if", "(", "defaultValue", "==", "null", ")", "return", "false", ";", "return", "defaultValue", ".", "equals", "(", "value2", ")", ";", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "MethodBinding", "methodBinding", "=", "this", ".", "internalPair", ".", "getMethodBinding", "(", ")", ";", "return", "methodBinding", "==", "null", "?", "false", ":", "methodBinding", ".", "isDeprecated", "(", ")", ";", "}", "public", "boolean", "isEqualTo", "(", "IBinding", "binding", ")", "{", "if", "(", "this", "==", "binding", ")", "return", "true", ";", "if", "(", "binding", ".", "getKind", "(", ")", "!=", "IBinding", ".", "MEMBER_VALUE_PAIR", ")", "return", "false", ";", "IMemberValuePairBinding", "otherMemberValuePairBinding", "=", "(", "IMemberValuePairBinding", ")", "binding", ";", "if", "(", "!", "getMethodBinding", "(", ")", ".", "isEqualTo", "(", "otherMemberValuePairBinding", ".", "getMethodBinding", "(", ")", ")", ")", "{", "return", "false", ";", "}", "Object", "otherValue", "=", "otherMemberValuePairBinding", ".", "getValue", "(", ")", ";", "Object", "currentValue", "=", "getValue", "(", ")", ";", "if", "(", "currentValue", "==", "null", ")", "{", "return", "otherValue", "==", "null", ";", "}", "if", "(", "currentValue", "instanceof", "IBinding", ")", "{", "if", "(", "otherValue", "instanceof", "IBinding", ")", "{", "return", "(", "(", "IBinding", ")", "currentValue", ")", ".", "isEqualTo", "(", "(", "IBinding", ")", "otherValue", ")", ";", "}", "return", "false", ";", "}", "if", "(", "currentValue", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "if", "(", "!", "otherValue", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "return", "false", ";", "}", "Object", "[", "]", "currentValues", "=", "(", "Object", "[", "]", ")", "currentValue", ";", "Object", "[", "]", "otherValues", "=", "(", "Object", "[", "]", ")", "otherValue", ";", "final", "int", "length", "=", "currentValues", ".", "length", ";", "if", "(", "length", "!=", "otherValues", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Object", "current", "=", "currentValues", "[", "i", "]", ";", "Object", "other", "=", "otherValues", "[", "i", "]", ";", "if", "(", "current", "instanceof", "IBinding", ")", "{", "if", "(", "!", "(", "other", "instanceof", "IBinding", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "(", "(", "IBinding", ")", "current", ")", ".", "isEqualTo", "(", "(", "IBinding", ")", "other", ")", ")", "{", "return", "false", ";", "}", "}", "else", "if", "(", "!", "current", ".", "equals", "(", "other", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "else", "{", "return", "currentValue", ".", "equals", "(", "otherValue", ")", ";", "}", "}", "public", "boolean", "isRecovered", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isSynthetic", "(", ")", "{", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "=", "\"", ")", ";", "appendValue", "(", "getValue", "(", ")", ",", "buffer", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,370
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ClassInstanceCreation", "extends", "Expression", "{", "public", "static", "final", "ChildListPropertyDescriptor", "TYPE_ARGUMENTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"\"", ",", "Type", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"name\"", ",", "Name", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"type\"", ",", "Type", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "ARGUMENTS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"arguments\"", ",", "Expression", ".", "class", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ClassInstanceCreation", ".", "class", ",", "\"\"", ",", "AnonymousClassDeclaration", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "5", ")", ";", "createPropertyList", "(", "ClassInstanceCreation", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ARGUMENTS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "properyList", "=", "new", "ArrayList", "(", "6", ")", ";", "createPropertyList", "(", "ClassInstanceCreation", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "TYPE_ARGUMENTS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "TYPE_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ARGUMENTS_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "Expression", "optionalExpression", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "typeArguments", "=", "null", ";", "private", "Name", "typeName", "=", "null", ";", "private", "Type", "type", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "arguments", "=", "new", "ASTNode", ".", "NodeList", "(", "ARGUMENTS_PROPERTY", ")", ";", "private", "AnonymousClassDeclaration", "optionalAnonymousClassDeclaration", "=", "null", ";", "ClassInstanceCreation", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "if", "(", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "this", ".", "typeArguments", "=", "new", "ASTNode", ".", "NodeList", "(", "TYPE_ARGUMENTS_PROPERTY", ")", ";", "}", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "TYPE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getType", "(", ")", ";", "}", "else", "{", "setType", "(", "(", "Type", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getAnonymousClassDeclaration", "(", ")", ";", "}", "else", "{", "setAnonymousClassDeclaration", "(", "(", "AnonymousClassDeclaration", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "ARGUMENTS_PROPERTY", ")", "{", "return", "arguments", "(", ")", ";", "}", "if", "(", "property", "==", "TYPE_ARGUMENTS_PROPERTY", ")", "{", "return", "typeArguments", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "CLASS_INSTANCE_CREATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ClassInstanceCreation", "result", "=", "new", "ClassInstanceCreation", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getExpression", "(", ")", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "result", ".", "setName", "(", "(", "Name", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "}", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "result", ".", "typeArguments", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "typeArguments", "(", ")", ")", ")", ";", "result", ".", "setType", "(", "(", "Type", ")", "getType", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "}", "result", ".", "arguments", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "arguments", "(", ")", ")", ")", ";", "result", ".", "setAnonymousClassDeclaration", "(", "(", "AnonymousClassDeclaration", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getAnonymousClassDeclaration", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "typeArguments", ")", ";", "acceptChild", "(", "visitor", ",", "getType", "(", ")", ")", ";", "}", "acceptChildren", "(", "visitor", ",", "this", ".", "arguments", ")", ";", "acceptChild", "(", "visitor", ",", "getAnonymousClassDeclaration", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "return", "this", ".", "optionalExpression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "optionalExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "List", "typeArguments", "(", ")", "{", "if", "(", "this", ".", "typeArguments", "==", "null", ")", "{", "unsupportedIn2", "(", ")", ";", "}", "return", "this", ".", "typeArguments", ";", "}", "public", "Name", "getName", "(", ")", "{", "return", "internalGetName", "(", ")", ";", "}", "Name", "internalGetName", "(", ")", "{", "supportedOnlyIn2", "(", ")", ";", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "typeName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "typeName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "typeName", ";", "}", "public", "void", "setName", "(", "Name", "name", ")", "{", "internalSetName", "(", "name", ")", ";", "}", "void", "internalSetName", "(", "Name", "name", ")", "{", "supportedOnlyIn2", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "typeName", ";", "preReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "this", ".", "typeName", "=", "name", ";", "postReplaceChild", "(", "oldChild", ",", "name", ",", "NAME_PROPERTY", ")", ";", "}", "public", "Type", "getType", "(", ")", "{", "unsupportedIn2", "(", ")", ";", "if", "(", "this", ".", "type", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "type", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "type", "=", "new", "SimpleType", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "type", ",", "TYPE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "type", ";", "}", "public", "void", "setType", "(", "Type", "type", ")", "{", "unsupportedIn2", "(", ")", ";", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "type", ";", "preReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "this", ".", "type", "=", "type", ";", "postReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "}", "public", "List", "arguments", "(", ")", "{", "return", "this", ".", "arguments", ";", "}", "public", "AnonymousClassDeclaration", "getAnonymousClassDeclaration", "(", ")", "{", "return", "this", ".", "optionalAnonymousClassDeclaration", ";", "}", "public", "void", "setAnonymousClassDeclaration", "(", "AnonymousClassDeclaration", "decl", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalAnonymousClassDeclaration", ";", "preReplaceChild", "(", "oldChild", ",", "decl", ",", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "this", ".", "optionalAnonymousClassDeclaration", "=", "decl", ";", "postReplaceChild", "(", "oldChild", ",", "decl", ",", "ANONYMOUS_CLASS_DECLARATION_PROPERTY", ")", ";", "}", "public", "IMethodBinding", "resolveConstructorBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveConstructor", "(", "this", ")", ";", "}", "public", "boolean", "isResolvedTypeInferredFromExpectedType", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "isResolvedTypeInferredFromExpectedType", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "6", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "type", "==", "null", "?", "0", ":", "getType", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalExpression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "typeArguments", "==", "null", "?", "0", ":", "this", ".", "typeArguments", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "arguments", "==", "null", "?", "0", ":", "this", ".", "arguments", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "optionalAnonymousClassDeclaration", "==", "null", "?", "0", ":", "getAnonymousClassDeclaration", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,371
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "public", "class", "TargetSourceRangeComputer", "{", "public", "static", "final", "class", "SourceRange", "{", "private", "int", "startPosition", ";", "private", "int", "length", ";", "public", "SourceRange", "(", "int", "startPosition", ",", "int", "length", ")", "{", "this", ".", "startPosition", "=", "startPosition", ";", "this", ".", "length", "=", "length", ";", "}", "public", "int", "getStartPosition", "(", ")", "{", "return", "this", ".", "startPosition", ";", "}", "public", "int", "getLength", "(", ")", "{", "return", "this", ".", "length", ";", "}", "}", "public", "TargetSourceRangeComputer", "(", ")", "{", "}", "public", "SourceRange", "computeSourceRange", "(", "ASTNode", "node", ")", "{", "ASTNode", "root", "=", "node", ".", "getRoot", "(", ")", ";", "if", "(", "root", "instanceof", "CompilationUnit", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "root", ";", "return", "new", "SourceRange", "(", "cu", ".", "getExtendedStartPosition", "(", "node", ")", ",", "cu", ".", "getExtendedLength", "(", "node", ")", ")", ";", "}", "return", "new", "SourceRange", "(", "node", ".", "getStartPosition", "(", ")", ",", "node", ".", "getLength", "(", ")", ")", ";", "}", "}", "</s>" ]
2,372
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Block", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ChildListPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Statement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "StructuralPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ListRewriteEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeInfoStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "CopySourceInfo", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "public", "final", "class", "ListRewrite", "{", "private", "ASTNode", "parent", ";", "private", "StructuralPropertyDescriptor", "childProperty", ";", "private", "ASTRewrite", "rewriter", ";", "ListRewrite", "(", "ASTRewrite", "rewriter", ",", "ASTNode", "parent", ",", "StructuralPropertyDescriptor", "childProperty", ")", "{", "this", ".", "rewriter", "=", "rewriter", ";", "this", ".", "parent", "=", "parent", ";", "this", ".", "childProperty", "=", "childProperty", ";", "}", "private", "RewriteEventStore", "getRewriteStore", "(", ")", "{", "return", "this", ".", "rewriter", ".", "getRewriteEventStore", "(", ")", ";", "}", "private", "ListRewriteEvent", "getEvent", "(", ")", "{", "return", "getRewriteStore", "(", ")", ".", "getListEvent", "(", "this", ".", "parent", ",", "this", ".", "childProperty", ",", "true", ")", ";", "}", "public", "ASTNode", "getParent", "(", ")", "{", "return", "this", ".", "parent", ";", "}", "public", "StructuralPropertyDescriptor", "getLocationInParent", "(", ")", "{", "return", "this", ".", "childProperty", ";", "}", "public", "void", "remove", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "RewriteEvent", "event", "=", "getEvent", "(", ")", ".", "removeEntry", "(", "node", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "getRewriteStore", "(", ")", ".", "setEventEditGroup", "(", "event", ",", "editGroup", ")", ";", "}", "}", "public", "ASTRewrite", "getASTRewrite", "(", ")", "{", "return", "this", ".", "rewriter", ";", "}", "public", "void", "replace", "(", "ASTNode", "node", ",", "ASTNode", "replacement", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "RewriteEvent", "event", "=", "getEvent", "(", ")", ".", "replaceEntry", "(", "node", ",", "replacement", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "getRewriteStore", "(", ")", ".", "setEventEditGroup", "(", "event", ",", "editGroup", ")", ";", "}", "}", "public", "void", "insertAfter", "(", "ASTNode", "node", ",", "ASTNode", "previousElement", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", "||", "previousElement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "int", "index", "=", "getEvent", "(", ")", ".", "getIndex", "(", "previousElement", ",", "ListRewriteEvent", ".", "BOTH", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "internalInsertAt", "(", "node", ",", "index", "+", "1", ",", "true", ",", "editGroup", ")", ";", "}", "public", "void", "insertBefore", "(", "ASTNode", "node", ",", "ASTNode", "nextElement", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", "||", "nextElement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "int", "index", "=", "getEvent", "(", ")", ".", "getIndex", "(", "nextElement", ",", "ListRewriteEvent", ".", "BOTH", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "internalInsertAt", "(", "node", ",", "index", ",", "false", ",", "editGroup", ")", ";", "}", "public", "void", "insertFirst", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "internalInsertAt", "(", "node", ",", "0", ",", "false", ",", "editGroup", ")", ";", "}", "public", "void", "insertLast", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "internalInsertAt", "(", "node", ",", "-", "1", ",", "true", ",", "editGroup", ")", ";", "}", "public", "void", "insertAt", "(", "ASTNode", "node", ",", "int", "index", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "internalInsertAt", "(", "node", ",", "index", ",", "isInsertBoundToPreviousByDefault", "(", "node", ")", ",", "editGroup", ")", ";", "}", "private", "void", "internalInsertAt", "(", "ASTNode", "node", ",", "int", "index", ",", "boolean", "boundToPrevious", ",", "TextEditGroup", "editGroup", ")", "{", "RewriteEvent", "event", "=", "getEvent", "(", ")", ".", "insert", "(", "node", ",", "index", ")", ";", "if", "(", "boundToPrevious", ")", "{", "getRewriteStore", "(", ")", ".", "setInsertBoundToPrevious", "(", "node", ")", ";", "}", "if", "(", "editGroup", "!=", "null", ")", "{", "getRewriteStore", "(", ")", ".", "setEventEditGroup", "(", "event", ",", "editGroup", ")", ";", "}", "}", "private", "ASTNode", "createTargetNode", "(", "ASTNode", "first", ",", "ASTNode", "last", ",", "boolean", "isMove", ",", "ASTNode", "replacingNode", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "first", "==", "null", "||", "last", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "NodeInfoStore", "nodeStore", "=", "this", ".", "rewriter", ".", "getNodeStore", "(", ")", ";", "ASTNode", "placeholder", "=", "nodeStore", ".", "newPlaceholderNode", "(", "first", ".", "getNodeType", "(", ")", ")", ";", "if", "(", "placeholder", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "first", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "Block", "internalPlaceHolder", "=", "nodeStore", ".", "createCollapsePlaceholder", "(", ")", ";", "CopySourceInfo", "info", "=", "getRewriteStore", "(", ")", ".", "createRangeCopy", "(", "this", ".", "parent", ",", "this", ".", "childProperty", ",", "first", ",", "last", ",", "isMove", ",", "internalPlaceHolder", ",", "replacingNode", ",", "editGroup", ")", ";", "nodeStore", ".", "markAsCopyTarget", "(", "placeholder", ",", "info", ")", ";", "return", "placeholder", ";", "}", "public", "final", "ASTNode", "createCopyTarget", "(", "ASTNode", "first", ",", "ASTNode", "last", ")", "{", "if", "(", "first", "==", "last", ")", "{", "return", "this", ".", "rewriter", ".", "createCopyTarget", "(", "first", ")", ";", "}", "else", "{", "return", "createTargetNode", "(", "first", ",", "last", ",", "false", ",", "null", ",", "null", ")", ";", "}", "}", "public", "final", "ASTNode", "createMoveTarget", "(", "ASTNode", "first", ",", "ASTNode", "last", ")", "{", "return", "createMoveTarget", "(", "first", ",", "last", ",", "null", ",", "null", ")", ";", "}", "public", "final", "ASTNode", "createMoveTarget", "(", "ASTNode", "first", ",", "ASTNode", "last", ",", "ASTNode", "replacingNode", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "first", "==", "last", ")", "{", "replace", "(", "first", ",", "replacingNode", ",", "editGroup", ")", ";", "return", "this", ".", "rewriter", ".", "createMoveTarget", "(", "first", ")", ";", "}", "else", "{", "return", "createTargetNode", "(", "first", ",", "last", ",", "true", ",", "replacingNode", ",", "editGroup", ")", ";", "}", "}", "private", "boolean", "isInsertBoundToPreviousByDefault", "(", "ASTNode", "node", ")", "{", "return", "(", "node", "instanceof", "Statement", "||", "node", "instanceof", "FieldDeclaration", ")", ";", "}", "public", "List", "getOriginalList", "(", ")", "{", "List", "list", "=", "(", "List", ")", "getEvent", "(", ")", ".", "getOriginalValue", "(", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}", "public", "List", "getRewrittenList", "(", ")", "{", "List", "list", "=", "(", "List", ")", "getEvent", "(", ")", ".", "getNewValue", "(", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}", "}", "</s>" ]
2,373
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ";", "public", "interface", "ITrackedNodePosition", "{", "public", "int", "getStartPosition", "(", ")", ";", "public", "int", "getLength", "(", ")", ";", "}", "</s>" ]
2,374
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SubProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IImportDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeRoot", ";", "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", ".", "core", ".", "dom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ImportRewriteAnalyzer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MultiTextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "final", "class", "ImportRewrite", "{", "public", "static", "abstract", "class", "ImportRewriteContext", "{", "public", "final", "static", "int", "RES_NAME_FOUND", "=", "1", ";", "public", "final", "static", "int", "RES_NAME_UNKNOWN", "=", "2", ";", "public", "final", "static", "int", "RES_NAME_CONFLICT", "=", "3", ";", "public", "final", "static", "int", "KIND_TYPE", "=", "1", ";", "public", "final", "static", "int", "KIND_STATIC_FIELD", "=", "2", ";", "public", "final", "static", "int", "KIND_STATIC_METHOD", "=", "3", ";", "public", "abstract", "int", "findInContext", "(", "String", "qualifier", ",", "String", "name", ",", "int", "kind", ")", ";", "}", "private", "static", "final", "char", "STATIC_PREFIX", "=", "'s'", ";", "private", "static", "final", "char", "NORMAL_PREFIX", "=", "'n'", ";", "private", "final", "ImportRewriteContext", "defaultContext", ";", "private", "final", "ICompilationUnit", "compilationUnit", ";", "private", "final", "CompilationUnit", "astRoot", ";", "private", "final", "boolean", "restoreExistingImports", ";", "private", "final", "List", "existingImports", ";", "private", "final", "Map", "importsKindMap", ";", "private", "String", "[", "]", "importOrder", ";", "private", "int", "importOnDemandThreshold", ";", "private", "int", "staticImportOnDemandThreshold", ";", "private", "List", "addedImports", ";", "private", "List", "removedImports", ";", "private", "String", "[", "]", "createdImports", ";", "private", "String", "[", "]", "createdStaticImports", ";", "private", "boolean", "filterImplicitImports", ";", "private", "boolean", "useContextToFilterImplicitImports", ";", "public", "static", "ImportRewrite", "create", "(", "ICompilationUnit", "cu", ",", "boolean", "restoreExistingImports", ")", "throws", "JavaModelException", "{", "if", "(", "cu", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "List", "existingImport", "=", "null", ";", "if", "(", "restoreExistingImports", ")", "{", "existingImport", "=", "new", "ArrayList", "(", ")", ";", "IImportDeclaration", "[", "]", "imports", "=", "cu", ".", "getImports", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "imports", ".", "length", ";", "i", "++", ")", "{", "IImportDeclaration", "curr", "=", "imports", "[", "i", "]", ";", "char", "prefix", "=", "Flags", ".", "isStatic", "(", "curr", ".", "getFlags", "(", ")", ")", "?", "STATIC_PREFIX", ":", "NORMAL_PREFIX", ";", "existingImport", ".", "add", "(", "prefix", "+", "curr", ".", "getElementName", "(", ")", ")", ";", "}", "}", "return", "new", "ImportRewrite", "(", "cu", ",", "null", ",", "existingImport", ")", ";", "}", "public", "static", "ImportRewrite", "create", "(", "CompilationUnit", "astRoot", ",", "boolean", "restoreExistingImports", ")", "{", "if", "(", "astRoot", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "ITypeRoot", "typeRoot", "=", "astRoot", ".", "getTypeRoot", "(", ")", ";", "if", "(", "!", "(", "typeRoot", "instanceof", "ICompilationUnit", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "List", "existingImport", "=", "null", ";", "if", "(", "restoreExistingImports", ")", "{", "existingImport", "=", "new", "ArrayList", "(", ")", ";", "List", "imports", "=", "astRoot", ".", "imports", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "imports", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ImportDeclaration", "curr", "=", "(", "ImportDeclaration", ")", "imports", ".", "get", "(", "i", ")", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "curr", ".", "isStatic", "(", ")", "?", "STATIC_PREFIX", ":", "NORMAL_PREFIX", ")", ".", "append", "(", "curr", ".", "getName", "(", ")", ".", "getFullyQualifiedName", "(", ")", ")", ";", "if", "(", "curr", ".", "isOnDemand", "(", ")", ")", "{", "if", "(", "buf", ".", "length", "(", ")", ">", "1", ")", "buf", ".", "append", "(", "'.'", ")", ";", "buf", ".", "append", "(", "'*'", ")", ";", "}", "existingImport", ".", "add", "(", "buf", ".", "toString", "(", ")", ")", ";", "}", "}", "return", "new", "ImportRewrite", "(", "(", "ICompilationUnit", ")", "typeRoot", ",", "astRoot", ",", "existingImport", ")", ";", "}", "private", "ImportRewrite", "(", "ICompilationUnit", "cu", ",", "CompilationUnit", "astRoot", ",", "List", "existingImports", ")", "{", "this", ".", "compilationUnit", "=", "cu", ";", "this", ".", "astRoot", "=", "astRoot", ";", "if", "(", "existingImports", "!=", "null", ")", "{", "this", ".", "existingImports", "=", "existingImports", ";", "this", ".", "restoreExistingImports", "=", "!", "existingImports", ".", "isEmpty", "(", ")", ";", "}", "else", "{", "this", ".", "existingImports", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "restoreExistingImports", "=", "false", ";", "}", "this", ".", "filterImplicitImports", "=", "true", ";", "this", ".", "useContextToFilterImplicitImports", "=", "false", ";", "this", ".", "defaultContext", "=", "new", "ImportRewriteContext", "(", ")", "{", "public", "int", "findInContext", "(", "String", "qualifier", ",", "String", "name", ",", "int", "kind", ")", "{", "return", "findInImports", "(", "qualifier", ",", "name", ",", "kind", ")", ";", "}", "}", ";", "this", ".", "addedImports", "=", "null", ";", "this", ".", "removedImports", "=", "null", ";", "this", ".", "createdImports", "=", "null", ";", "this", ".", "createdStaticImports", "=", "null", ";", "this", ".", "importOrder", "=", "CharOperation", ".", "NO_STRINGS", ";", "this", ".", "importOnDemandThreshold", "=", "99", ";", "this", ".", "staticImportOnDemandThreshold", "=", "99", ";", "this", ".", "importsKindMap", "=", "new", "HashMap", "(", ")", ";", "}", "public", "void", "setImportOrder", "(", "String", "[", "]", "order", ")", "{", "if", "(", "order", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "this", ".", "importOrder", "=", "order", ";", "}", "public", "void", "setOnDemandImportThreshold", "(", "int", "threshold", ")", "{", "if", "(", "threshold", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "this", ".", "importOnDemandThreshold", "=", "threshold", ";", "}", "public", "void", "setStaticOnDemandImportThreshold", "(", "int", "threshold", ")", "{", "if", "(", "threshold", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "this", ".", "staticImportOnDemandThreshold", "=", "threshold", ";", "}", "public", "ICompilationUnit", "getCompilationUnit", "(", ")", "{", "return", "this", ".", "compilationUnit", ";", "}", "public", "ImportRewriteContext", "getDefaultImportRewriteContext", "(", ")", "{", "return", "this", ".", "defaultContext", ";", "}", "public", "void", "setFilterImplicitImports", "(", "boolean", "filterImplicitImports", ")", "{", "this", ".", "filterImplicitImports", "=", "filterImplicitImports", ";", "}", "public", "void", "setUseContextToFilterImplicitImports", "(", "boolean", "useContextToFilterImplicitImports", ")", "{", "this", ".", "useContextToFilterImplicitImports", "=", "useContextToFilterImplicitImports", ";", "}", "private", "static", "int", "compareImport", "(", "char", "prefix", ",", "String", "qualifier", ",", "String", "name", ",", "String", "curr", ")", "{", "if", "(", "curr", ".", "charAt", "(", "0", ")", "!=", "prefix", "||", "!", "curr", ".", "endsWith", "(", "name", ")", ")", "{", "return", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ";", "}", "curr", "=", "curr", ".", "substring", "(", "1", ")", ";", "if", "(", "curr", ".", "length", "(", ")", "==", "name", ".", "length", "(", ")", ")", "{", "if", "(", "qualifier", ".", "length", "(", ")", "==", "0", ")", "{", "return", "ImportRewriteContext", ".", "RES_NAME_FOUND", ";", "}", "return", "ImportRewriteContext", ".", "RES_NAME_CONFLICT", ";", "}", "int", "dotPos", "=", "curr", ".", "length", "(", ")", "-", "name", ".", "length", "(", ")", "-", "1", ";", "if", "(", "curr", ".", "charAt", "(", "dotPos", ")", "!=", "'.'", ")", "{", "return", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ";", "}", "if", "(", "qualifier", ".", "length", "(", ")", "!=", "dotPos", "||", "!", "curr", ".", "startsWith", "(", "qualifier", ")", ")", "{", "return", "ImportRewriteContext", ".", "RES_NAME_CONFLICT", ";", "}", "return", "ImportRewriteContext", ".", "RES_NAME_FOUND", ";", "}", "final", "int", "findInImports", "(", "String", "qualifier", ",", "String", "name", ",", "int", "kind", ")", "{", "boolean", "allowAmbiguity", "=", "(", "kind", "==", "ImportRewriteContext", ".", "KIND_STATIC_METHOD", ")", "||", "(", "name", ".", "length", "(", ")", "==", "1", "&&", "name", ".", "charAt", "(", "0", ")", "==", "'*'", ")", ";", "List", "imports", "=", "this", ".", "existingImports", ";", "char", "prefix", "=", "(", "kind", "==", "ImportRewriteContext", ".", "KIND_TYPE", ")", "?", "NORMAL_PREFIX", ":", "STATIC_PREFIX", ";", "for", "(", "int", "i", "=", "imports", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "String", "curr", "=", "(", "String", ")", "imports", ".", "get", "(", "i", ")", ";", "int", "res", "=", "compareImport", "(", "prefix", ",", "qualifier", ",", "name", ",", "curr", ")", ";", "if", "(", "res", "!=", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ")", "{", "if", "(", "!", "allowAmbiguity", "||", "res", "==", "ImportRewriteContext", ".", "RES_NAME_FOUND", ")", "{", "if", "(", "prefix", "!=", "STATIC_PREFIX", ")", "{", "return", "res", ";", "}", "Object", "currKind", "=", "this", ".", "importsKindMap", ".", "get", "(", "curr", ".", "substring", "(", "1", ")", ")", ";", "if", "(", "currKind", "!=", "null", "&&", "currKind", ".", "equals", "(", "this", ".", "importsKindMap", ".", "get", "(", "qualifier", "+", "'.'", "+", "name", ")", ")", ")", "{", "return", "res", ";", "}", "}", "}", "}", "if", "(", "this", ".", "filterImplicitImports", "&&", "this", ".", "useContextToFilterImplicitImports", ")", "{", "String", "fPackageName", "=", "this", ".", "compilationUnit", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ";", "String", "mainTypeSimpleName", "=", "JavaCore", ".", "removeJavaLikeExtension", "(", "this", ".", "compilationUnit", ".", "getElementName", "(", ")", ")", ";", "String", "fMainTypeName", "=", "Util", ".", "concatenateName", "(", "fPackageName", ",", "mainTypeSimpleName", ",", "'.'", ")", ";", "if", "(", "kind", "==", "ImportRewriteContext", ".", "KIND_TYPE", "&&", "(", "qualifier", ".", "equals", "(", "fPackageName", ")", "||", "fMainTypeName", ".", "equals", "(", "Util", ".", "concatenateName", "(", "qualifier", ",", "name", ",", "'.'", ")", ")", ")", ")", "return", "ImportRewriteContext", ".", "RES_NAME_FOUND", ";", "}", "return", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ";", "}", "public", "Type", "addImportFromSignature", "(", "String", "typeSig", ",", "AST", "ast", ")", "{", "return", "addImportFromSignature", "(", "typeSig", ",", "ast", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "Type", "addImportFromSignature", "(", "String", "typeSig", ",", "AST", "ast", ",", "ImportRewriteContext", "context", ")", "{", "if", "(", "typeSig", "==", "null", "||", "typeSig", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "int", "sigKind", "=", "Signature", ".", "getTypeSignatureKind", "(", "typeSig", ")", ";", "switch", "(", "sigKind", ")", "{", "case", "Signature", ".", "BASE_TYPE_SIGNATURE", ":", "return", "ast", ".", "newPrimitiveType", "(", "PrimitiveType", ".", "toCode", "(", "Signature", ".", "toString", "(", "typeSig", ")", ")", ")", ";", "case", "Signature", ".", "ARRAY_TYPE_SIGNATURE", ":", "Type", "elementType", "=", "addImportFromSignature", "(", "Signature", ".", "getElementType", "(", "typeSig", ")", ",", "ast", ",", "context", ")", ";", "return", "ast", ".", "newArrayType", "(", "elementType", ",", "Signature", ".", "getArrayCount", "(", "typeSig", ")", ")", ";", "case", "Signature", ".", "CLASS_TYPE_SIGNATURE", ":", "String", "erasureSig", "=", "Signature", ".", "getTypeErasure", "(", "typeSig", ")", ";", "String", "erasureName", "=", "Signature", ".", "toString", "(", "erasureSig", ")", ";", "if", "(", "erasureSig", ".", "charAt", "(", "0", ")", "==", "Signature", ".", "C_RESOLVED", ")", "{", "erasureName", "=", "internalAddImport", "(", "erasureName", ",", "context", ")", ";", "}", "Type", "baseType", "=", "ast", ".", "newSimpleType", "(", "ast", ".", "newName", "(", "erasureName", ")", ")", ";", "String", "[", "]", "typeArguments", "=", "Signature", ".", "getTypeArguments", "(", "typeSig", ")", ";", "if", "(", "typeArguments", ".", "length", ">", "0", ")", "{", "ParameterizedType", "type", "=", "ast", ".", "newParameterizedType", "(", "baseType", ")", ";", "List", "argNodes", "=", "type", ".", "typeArguments", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArguments", ".", "length", ";", "i", "++", ")", "{", "String", "curr", "=", "typeArguments", "[", "i", "]", ";", "if", "(", "containsNestedCapture", "(", "curr", ")", ")", "{", "argNodes", ".", "add", "(", "ast", ".", "newWildcardType", "(", ")", ")", ";", "}", "else", "{", "argNodes", ".", "add", "(", "addImportFromSignature", "(", "curr", ",", "ast", ",", "context", ")", ")", ";", "}", "}", "return", "type", ";", "}", "return", "baseType", ";", "case", "Signature", ".", "TYPE_VARIABLE_SIGNATURE", ":", "return", "ast", ".", "newSimpleType", "(", "ast", ".", "newSimpleName", "(", "Signature", ".", "toString", "(", "typeSig", ")", ")", ")", ";", "case", "Signature", ".", "WILDCARD_TYPE_SIGNATURE", ":", "WildcardType", "wildcardType", "=", "ast", ".", "newWildcardType", "(", ")", ";", "char", "ch", "=", "typeSig", ".", "charAt", "(", "0", ")", ";", "if", "(", "ch", "!=", "Signature", ".", "C_STAR", ")", "{", "Type", "bound", "=", "addImportFromSignature", "(", "typeSig", ".", "substring", "(", "1", ")", ",", "ast", ",", "context", ")", ";", "wildcardType", ".", "setBound", "(", "bound", ",", "ch", "==", "Signature", ".", "C_EXTENDS", ")", ";", "}", "return", "wildcardType", ";", "case", "Signature", ".", "CAPTURE_TYPE_SIGNATURE", ":", "return", "addImportFromSignature", "(", "typeSig", ".", "substring", "(", "1", ")", ",", "ast", ",", "context", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "typeSig", ")", ";", "}", "}", "public", "String", "addImport", "(", "ITypeBinding", "binding", ")", "{", "return", "addImport", "(", "binding", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "String", "addImport", "(", "ITypeBinding", "binding", ",", "ImportRewriteContext", "context", ")", "{", "if", "(", "binding", ".", "isPrimitive", "(", ")", "||", "binding", ".", "isTypeVariable", "(", ")", "||", "binding", ".", "isRecovered", "(", ")", ")", "{", "return", "binding", ".", "getName", "(", ")", ";", "}", "ITypeBinding", "normalizedBinding", "=", "normalizeTypeBinding", "(", "binding", ")", ";", "if", "(", "normalizedBinding", "==", "null", ")", "{", "return", "\"invalid\"", ";", "}", "if", "(", "normalizedBinding", ".", "isWildcardType", "(", ")", ")", "{", "StringBuffer", "res", "=", "new", "StringBuffer", "(", "\"?\"", ")", ";", "ITypeBinding", "bound", "=", "normalizedBinding", ".", "getBound", "(", ")", ";", "if", "(", "bound", "!=", "null", "&&", "!", "bound", ".", "isWildcardType", "(", ")", "&&", "!", "bound", ".", "isCapture", "(", ")", ")", "{", "if", "(", "normalizedBinding", ".", "isUpperbound", "(", ")", ")", "{", "res", ".", "append", "(", "\"", "extends", "\"", ")", ";", "}", "else", "{", "res", ".", "append", "(", "\"", "super", "\"", ")", ";", "}", "res", ".", "append", "(", "addImport", "(", "bound", ",", "context", ")", ")", ";", "}", "return", "res", ".", "toString", "(", ")", ";", "}", "if", "(", "normalizedBinding", ".", "isArray", "(", ")", ")", "{", "StringBuffer", "res", "=", "new", "StringBuffer", "(", "addImport", "(", "normalizedBinding", ".", "getElementType", "(", ")", ",", "context", ")", ")", ";", "for", "(", "int", "i", "=", "normalizedBinding", ".", "getDimensions", "(", ")", ";", "i", ">", "0", ";", "i", "--", ")", "{", "res", ".", "append", "(", "\"[]\"", ")", ";", "}", "return", "res", ".", "toString", "(", ")", ";", "}", "String", "qualifiedName", "=", "getRawQualifiedName", "(", "normalizedBinding", ")", ";", "if", "(", "qualifiedName", ".", "length", "(", ")", ">", "0", ")", "{", "String", "str", "=", "internalAddImport", "(", "qualifiedName", ",", "context", ")", ";", "ITypeBinding", "[", "]", "typeArguments", "=", "normalizedBinding", ".", "getTypeArguments", "(", ")", ";", "if", "(", "typeArguments", ".", "length", ">", "0", ")", "{", "StringBuffer", "res", "=", "new", "StringBuffer", "(", "str", ")", ";", "res", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "res", ".", "append", "(", "','", ")", ";", "}", "ITypeBinding", "curr", "=", "typeArguments", "[", "i", "]", ";", "if", "(", "containsNestedCapture", "(", "curr", ",", "false", ")", ")", "{", "res", ".", "append", "(", "'?'", ")", ";", "}", "else", "{", "res", ".", "append", "(", "addImport", "(", "curr", ",", "context", ")", ")", ";", "}", "}", "res", ".", "append", "(", "'>'", ")", ";", "return", "res", ".", "toString", "(", ")", ";", "}", "return", "str", ";", "}", "return", "getRawName", "(", "normalizedBinding", ")", ";", "}", "private", "boolean", "containsNestedCapture", "(", "ITypeBinding", "binding", ",", "boolean", "isNested", ")", "{", "if", "(", "binding", "==", "null", "||", "binding", ".", "isPrimitive", "(", ")", "||", "binding", ".", "isTypeVariable", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "binding", ".", "isCapture", "(", ")", ")", "{", "if", "(", "isNested", ")", "{", "return", "true", ";", "}", "return", "containsNestedCapture", "(", "binding", ".", "getWildcard", "(", ")", ",", "true", ")", ";", "}", "if", "(", "binding", ".", "isWildcardType", "(", ")", ")", "{", "return", "containsNestedCapture", "(", "binding", ".", "getBound", "(", ")", ",", "true", ")", ";", "}", "if", "(", "binding", ".", "isArray", "(", ")", ")", "{", "return", "containsNestedCapture", "(", "binding", ".", "getElementType", "(", ")", ",", "true", ")", ";", "}", "ITypeBinding", "[", "]", "typeArguments", "=", "binding", ".", "getTypeArguments", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "containsNestedCapture", "(", "typeArguments", "[", "i", "]", ",", "true", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "containsNestedCapture", "(", "String", "signature", ")", "{", "return", "signature", ".", "length", "(", ")", ">", "1", "&&", "signature", ".", "indexOf", "(", "Signature", ".", "C_CAPTURE", ",", "1", ")", "!=", "-", "1", ";", "}", "private", "static", "ITypeBinding", "normalizeTypeBinding", "(", "ITypeBinding", "binding", ")", "{", "if", "(", "binding", "!=", "null", "&&", "!", "binding", ".", "isNullType", "(", ")", "&&", "!", "\"void\"", ".", "equals", "(", "binding", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "binding", ".", "isAnonymous", "(", ")", ")", "{", "ITypeBinding", "[", "]", "baseBindings", "=", "binding", ".", "getInterfaces", "(", ")", ";", "if", "(", "baseBindings", ".", "length", ">", "0", ")", "{", "return", "baseBindings", "[", "0", "]", ";", "}", "return", "binding", ".", "getSuperclass", "(", ")", ";", "}", "if", "(", "binding", ".", "isCapture", "(", ")", ")", "{", "return", "binding", ".", "getWildcard", "(", ")", ";", "}", "return", "binding", ";", "}", "return", "null", ";", "}", "public", "Type", "addImport", "(", "ITypeBinding", "binding", ",", "AST", "ast", ")", "{", "return", "addImport", "(", "binding", ",", "ast", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "Type", "addImport", "(", "ITypeBinding", "binding", ",", "AST", "ast", ",", "ImportRewriteContext", "context", ")", "{", "if", "(", "binding", ".", "isPrimitive", "(", ")", ")", "{", "return", "ast", ".", "newPrimitiveType", "(", "PrimitiveType", ".", "toCode", "(", "binding", ".", "getName", "(", ")", ")", ")", ";", "}", "ITypeBinding", "normalizedBinding", "=", "normalizeTypeBinding", "(", "binding", ")", ";", "if", "(", "normalizedBinding", "==", "null", ")", "{", "return", "ast", ".", "newSimpleType", "(", "ast", ".", "newSimpleName", "(", "\"invalid\"", ")", ")", ";", "}", "if", "(", "normalizedBinding", ".", "isTypeVariable", "(", ")", ")", "{", "return", "ast", ".", "newSimpleType", "(", "ast", ".", "newSimpleName", "(", "binding", ".", "getName", "(", ")", ")", ")", ";", "}", "if", "(", "normalizedBinding", ".", "isWildcardType", "(", ")", ")", "{", "WildcardType", "wcType", "=", "ast", ".", "newWildcardType", "(", ")", ";", "ITypeBinding", "bound", "=", "normalizedBinding", ".", "getBound", "(", ")", ";", "if", "(", "bound", "!=", "null", "&&", "!", "bound", ".", "isWildcardType", "(", ")", "&&", "!", "bound", ".", "isCapture", "(", ")", ")", "{", "Type", "boundType", "=", "addImport", "(", "bound", ",", "ast", ",", "context", ")", ";", "wcType", ".", "setBound", "(", "boundType", ",", "normalizedBinding", ".", "isUpperbound", "(", ")", ")", ";", "}", "return", "wcType", ";", "}", "if", "(", "normalizedBinding", ".", "isArray", "(", ")", ")", "{", "Type", "elementType", "=", "addImport", "(", "normalizedBinding", ".", "getElementType", "(", ")", ",", "ast", ",", "context", ")", ";", "return", "ast", ".", "newArrayType", "(", "elementType", ",", "normalizedBinding", ".", "getDimensions", "(", ")", ")", ";", "}", "String", "qualifiedName", "=", "getRawQualifiedName", "(", "normalizedBinding", ")", ";", "if", "(", "qualifiedName", ".", "length", "(", ")", ">", "0", ")", "{", "String", "res", "=", "internalAddImport", "(", "qualifiedName", ",", "context", ")", ";", "ITypeBinding", "[", "]", "typeArguments", "=", "normalizedBinding", ".", "getTypeArguments", "(", ")", ";", "if", "(", "typeArguments", ".", "length", ">", "0", ")", "{", "Type", "erasureType", "=", "ast", ".", "newSimpleType", "(", "ast", ".", "newName", "(", "res", ")", ")", ";", "ParameterizedType", "paramType", "=", "ast", ".", "newParameterizedType", "(", "erasureType", ")", ";", "List", "arguments", "=", "paramType", ".", "typeArguments", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArguments", ".", "length", ";", "i", "++", ")", "{", "ITypeBinding", "curr", "=", "typeArguments", "[", "i", "]", ";", "if", "(", "containsNestedCapture", "(", "curr", ",", "false", ")", ")", "{", "arguments", ".", "add", "(", "ast", ".", "newWildcardType", "(", ")", ")", ";", "}", "else", "{", "arguments", ".", "add", "(", "addImport", "(", "curr", ",", "ast", ",", "context", ")", ")", ";", "}", "}", "return", "paramType", ";", "}", "return", "ast", ".", "newSimpleType", "(", "ast", ".", "newName", "(", "res", ")", ")", ";", "}", "return", "ast", ".", "newSimpleType", "(", "ast", ".", "newName", "(", "getRawName", "(", "normalizedBinding", ")", ")", ")", ";", "}", "public", "String", "addImport", "(", "String", "qualifiedTypeName", ",", "ImportRewriteContext", "context", ")", "{", "int", "angleBracketOffset", "=", "qualifiedTypeName", ".", "indexOf", "(", "'<'", ")", ";", "if", "(", "angleBracketOffset", "!=", "-", "1", ")", "{", "return", "internalAddImport", "(", "qualifiedTypeName", ".", "substring", "(", "0", ",", "angleBracketOffset", ")", ",", "context", ")", "+", "qualifiedTypeName", ".", "substring", "(", "angleBracketOffset", ")", ";", "}", "int", "bracketOffset", "=", "qualifiedTypeName", ".", "indexOf", "(", "'['", ")", ";", "if", "(", "bracketOffset", "!=", "-", "1", ")", "{", "return", "internalAddImport", "(", "qualifiedTypeName", ".", "substring", "(", "0", ",", "bracketOffset", ")", ",", "context", ")", "+", "qualifiedTypeName", ".", "substring", "(", "bracketOffset", ")", ";", "}", "return", "internalAddImport", "(", "qualifiedTypeName", ",", "context", ")", ";", "}", "public", "String", "addImport", "(", "String", "qualifiedTypeName", ")", "{", "return", "addImport", "(", "qualifiedTypeName", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "String", "addStaticImport", "(", "IBinding", "binding", ")", "{", "return", "addStaticImport", "(", "binding", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "String", "addStaticImport", "(", "IBinding", "binding", ",", "ImportRewriteContext", "context", ")", "{", "if", "(", "Modifier", ".", "isStatic", "(", "binding", ".", "getModifiers", "(", ")", ")", ")", "{", "if", "(", "binding", "instanceof", "IVariableBinding", ")", "{", "IVariableBinding", "variableBinding", "=", "(", "IVariableBinding", ")", "binding", ";", "if", "(", "variableBinding", ".", "isField", "(", ")", ")", "{", "ITypeBinding", "declaringType", "=", "variableBinding", ".", "getDeclaringClass", "(", ")", ";", "return", "addStaticImport", "(", "getRawQualifiedName", "(", "declaringType", ")", ",", "binding", ".", "getName", "(", ")", ",", "true", ",", "context", ")", ";", "}", "}", "else", "if", "(", "binding", "instanceof", "IMethodBinding", ")", "{", "ITypeBinding", "declaringType", "=", "(", "(", "IMethodBinding", ")", "binding", ")", ".", "getDeclaringClass", "(", ")", ";", "return", "addStaticImport", "(", "getRawQualifiedName", "(", "declaringType", ")", ",", "binding", ".", "getName", "(", ")", ",", "false", ",", "context", ")", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "public", "String", "addStaticImport", "(", "String", "declaringTypeName", ",", "String", "simpleName", ",", "boolean", "isField", ")", "{", "return", "addStaticImport", "(", "declaringTypeName", ",", "simpleName", ",", "isField", ",", "this", ".", "defaultContext", ")", ";", "}", "public", "String", "addStaticImport", "(", "String", "declaringTypeName", ",", "String", "simpleName", ",", "boolean", "isField", ",", "ImportRewriteContext", "context", ")", "{", "String", "key", "=", "declaringTypeName", "+", "'.'", "+", "simpleName", ";", "if", "(", "declaringTypeName", ".", "indexOf", "(", "'.'", ")", "==", "-", "1", ")", "{", "return", "key", ";", "}", "if", "(", "context", "==", "null", ")", "{", "context", "=", "this", ".", "defaultContext", ";", "}", "int", "kind", "=", "isField", "?", "ImportRewriteContext", ".", "KIND_STATIC_FIELD", ":", "ImportRewriteContext", ".", "KIND_STATIC_METHOD", ";", "this", ".", "importsKindMap", ".", "put", "(", "key", ",", "new", "Integer", "(", "kind", ")", ")", ";", "int", "res", "=", "context", ".", "findInContext", "(", "declaringTypeName", ",", "simpleName", ",", "kind", ")", ";", "if", "(", "res", "==", "ImportRewriteContext", ".", "RES_NAME_CONFLICT", ")", "{", "return", "key", ";", "}", "if", "(", "res", "==", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ")", "{", "addEntry", "(", "STATIC_PREFIX", "+", "key", ")", ";", "}", "return", "simpleName", ";", "}", "private", "String", "internalAddImport", "(", "String", "fullTypeName", ",", "ImportRewriteContext", "context", ")", "{", "int", "idx", "=", "fullTypeName", ".", "lastIndexOf", "(", "'.'", ")", ";", "String", "typeContainerName", ",", "typeName", ";", "if", "(", "idx", "!=", "-", "1", ")", "{", "typeContainerName", "=", "fullTypeName", ".", "substring", "(", "0", ",", "idx", ")", ";", "typeName", "=", "fullTypeName", ".", "substring", "(", "idx", "+", "1", ")", ";", "}", "else", "{", "typeContainerName", "=", "\"\"", ";", "typeName", "=", "fullTypeName", ";", "}", "if", "(", "typeContainerName", ".", "length", "(", ")", "==", "0", "&&", "PrimitiveType", ".", "toCode", "(", "typeName", ")", "!=", "null", ")", "{", "return", "fullTypeName", ";", "}", "if", "(", "context", "==", "null", ")", "context", "=", "this", ".", "defaultContext", ";", "int", "res", "=", "context", ".", "findInContext", "(", "typeContainerName", ",", "typeName", ",", "ImportRewriteContext", ".", "KIND_TYPE", ")", ";", "if", "(", "res", "==", "ImportRewriteContext", ".", "RES_NAME_CONFLICT", ")", "{", "return", "fullTypeName", ";", "}", "if", "(", "res", "==", "ImportRewriteContext", ".", "RES_NAME_UNKNOWN", ")", "{", "addEntry", "(", "NORMAL_PREFIX", "+", "fullTypeName", ")", ";", "}", "return", "typeName", ";", "}", "private", "void", "addEntry", "(", "String", "entry", ")", "{", "this", ".", "existingImports", ".", "add", "(", "entry", ")", ";", "if", "(", "this", ".", "removedImports", "!=", "null", ")", "{", "if", "(", "this", ".", "removedImports", ".", "remove", "(", "entry", ")", ")", "{", "return", ";", "}", "}", "if", "(", "this", ".", "addedImports", "==", "null", ")", "{", "this", ".", "addedImports", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "addedImports", ".", "add", "(", "entry", ")", ";", "}", "private", "boolean", "removeEntry", "(", "String", "entry", ")", "{", "if", "(", "this", ".", "existingImports", ".", "remove", "(", "entry", ")", ")", "{", "if", "(", "this", ".", "addedImports", "!=", "null", ")", "{", "if", "(", "this", ".", "addedImports", ".", "remove", "(", "entry", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "this", ".", "removedImports", "==", "null", ")", "{", "this", ".", "removedImports", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "removedImports", ".", "add", "(", "entry", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "removeImport", "(", "String", "qualifiedName", ")", "{", "return", "removeEntry", "(", "NORMAL_PREFIX", "+", "qualifiedName", ")", ";", "}", "public", "boolean", "removeStaticImport", "(", "String", "qualifiedName", ")", "{", "return", "removeEntry", "(", "STATIC_PREFIX", "+", "qualifiedName", ")", ";", "}", "private", "static", "String", "getRawName", "(", "ITypeBinding", "normalizedBinding", ")", "{", "return", "normalizedBinding", ".", "getTypeDeclaration", "(", ")", ".", "getName", "(", ")", ";", "}", "private", "static", "String", "getRawQualifiedName", "(", "ITypeBinding", "normalizedBinding", ")", "{", "return", "normalizedBinding", ".", "getTypeDeclaration", "(", ")", ".", "getQualifiedName", "(", ")", ";", "}", "public", "final", "TextEdit", "rewriteImports", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "if", "(", "monitor", "==", "null", ")", "{", "monitor", "=", "new", "NullProgressMonitor", "(", ")", ";", "}", "try", "{", "monitor", ".", "beginTask", "(", "Messages", ".", "bind", "(", "Messages", ".", "importRewrite_processDescription", ")", ",", "2", ")", ";", "if", "(", "!", "hasRecordedChanges", "(", ")", ")", "{", "this", ".", "createdImports", "=", "CharOperation", ".", "NO_STRINGS", ";", "this", ".", "createdStaticImports", "=", "CharOperation", ".", "NO_STRINGS", ";", "return", "new", "MultiTextEdit", "(", ")", ";", "}", "CompilationUnit", "usedAstRoot", "=", "this", ".", "astRoot", ";", "if", "(", "usedAstRoot", "==", "null", ")", "{", "ASTParser", "parser", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS4", ")", ";", "parser", ".", "setSource", "(", "this", ".", "compilationUnit", ")", ";", "parser", ".", "setFocalPosition", "(", "0", ")", ";", "parser", ".", "setResolveBindings", "(", "false", ")", ";", "usedAstRoot", "=", "(", "CompilationUnit", ")", "parser", ".", "createAST", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "1", ")", ")", ";", "}", "ImportRewriteAnalyzer", "computer", "=", "new", "ImportRewriteAnalyzer", "(", "this", ".", "compilationUnit", ",", "usedAstRoot", ",", "this", ".", "importOrder", ",", "this", ".", "importOnDemandThreshold", ",", "this", ".", "staticImportOnDemandThreshold", ",", "this", ".", "restoreExistingImports", ",", "this", ".", "useContextToFilterImplicitImports", ")", ";", "computer", ".", "setFilterImplicitImports", "(", "this", ".", "filterImplicitImports", ")", ";", "if", "(", "this", ".", "addedImports", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "addedImports", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curr", "=", "(", "String", ")", "this", ".", "addedImports", ".", "get", "(", "i", ")", ";", "computer", ".", "addImport", "(", "curr", ".", "substring", "(", "1", ")", ",", "STATIC_PREFIX", "==", "curr", ".", "charAt", "(", "0", ")", ")", ";", "}", "}", "if", "(", "this", ".", "removedImports", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "removedImports", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curr", "=", "(", "String", ")", "this", ".", "removedImports", ".", "get", "(", "i", ")", ";", "computer", ".", "removeImport", "(", "curr", ".", "substring", "(", "1", ")", ",", "STATIC_PREFIX", "==", "curr", ".", "charAt", "(", "0", ")", ")", ";", "}", "}", "TextEdit", "result", "=", "computer", ".", "getResultingEdits", "(", "new", "SubProgressMonitor", "(", "monitor", ",", "1", ")", ")", ";", "this", ".", "createdImports", "=", "computer", ".", "getCreatedImports", "(", ")", ";", "this", ".", "createdStaticImports", "=", "computer", ".", "getCreatedStaticImports", "(", ")", ";", "return", "result", ";", "}", "finally", "{", "monitor", ".", "done", "(", ")", ";", "}", "}", "public", "String", "[", "]", "getCreatedImports", "(", ")", "{", "return", "this", ".", "createdImports", ";", "}", "public", "String", "[", "]", "getCreatedStaticImports", "(", ")", "{", "return", "this", ".", "createdStaticImports", ";", "}", "public", "String", "[", "]", "getAddedImports", "(", ")", "{", "return", "filterFromList", "(", "this", ".", "addedImports", ",", "NORMAL_PREFIX", ")", ";", "}", "public", "String", "[", "]", "getAddedStaticImports", "(", ")", "{", "return", "filterFromList", "(", "this", ".", "addedImports", ",", "STATIC_PREFIX", ")", ";", "}", "public", "String", "[", "]", "getRemovedImports", "(", ")", "{", "return", "filterFromList", "(", "this", ".", "removedImports", ",", "NORMAL_PREFIX", ")", ";", "}", "public", "String", "[", "]", "getRemovedStaticImports", "(", ")", "{", "return", "filterFromList", "(", "this", ".", "removedImports", ",", "STATIC_PREFIX", ")", ";", "}", "public", "boolean", "hasRecordedChanges", "(", ")", "{", "return", "!", "this", ".", "restoreExistingImports", "||", "(", "this", ".", "addedImports", "!=", "null", "&&", "!", "this", ".", "addedImports", ".", "isEmpty", "(", ")", ")", "||", "(", "this", ".", "removedImports", "!=", "null", "&&", "!", "this", ".", "removedImports", ".", "isEmpty", "(", ")", ")", ";", "}", "private", "static", "String", "[", "]", "filterFromList", "(", "List", "imports", ",", "char", "prefix", ")", "{", "if", "(", "imports", "==", "null", ")", "{", "return", "CharOperation", ".", "NO_STRINGS", ";", "}", "ArrayList", "res", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "imports", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curr", "=", "(", "String", ")", "imports", ".", "get", "(", "i", ")", ";", "if", "(", "prefix", "==", "curr", ".", "charAt", "(", "0", ")", ")", "{", "res", ".", "add", "(", "curr", ".", "substring", "(", "1", ")", ")", ";", "}", "}", "return", "(", "String", "[", "]", ")", "res", ".", "toArray", "(", "new", "String", "[", "res", ".", "size", "(", ")", "]", ")", ";", "}", "}", "</s>" ]
2,375
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "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", ".", "Block", ";", "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", ".", "internal", ".", "compiler", ".", "parser", ".", "RecoveryScannerData", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewriteAnalyzer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "LineInformation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeInfoStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeRewriteEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "TrackedNodePosition", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "CopySourceInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "PropertyLocation", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "TextUtilities", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MultiTextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "public", "class", "ASTRewrite", "{", "private", "final", "AST", "ast", ";", "private", "final", "RewriteEventStore", "eventStore", ";", "private", "final", "NodeInfoStore", "nodeStore", ";", "private", "TargetSourceRangeComputer", "targetSourceRangeComputer", "=", "null", ";", "private", "Object", "property1", "=", "null", ";", "private", "Object", "property2", "=", "null", ";", "public", "static", "ASTRewrite", "create", "(", "AST", "ast", ")", "{", "return", "new", "ASTRewrite", "(", "ast", ")", ";", "}", "protected", "ASTRewrite", "(", "AST", "ast", ")", "{", "this", ".", "ast", "=", "ast", ";", "this", ".", "eventStore", "=", "new", "RewriteEventStore", "(", ")", ";", "this", ".", "nodeStore", "=", "new", "NodeInfoStore", "(", "ast", ")", ";", "}", "public", "final", "AST", "getAST", "(", ")", "{", "return", "this", ".", "ast", ";", "}", "protected", "final", "RewriteEventStore", "getRewriteEventStore", "(", ")", "{", "return", "this", ".", "eventStore", ";", "}", "protected", "final", "NodeInfoStore", "getNodeStore", "(", ")", "{", "return", "this", ".", "nodeStore", ";", "}", "public", "TextEdit", "rewriteAST", "(", "IDocument", "document", ",", "Map", "options", ")", "throws", "IllegalArgumentException", "{", "if", "(", "document", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "rootNode", "=", "getRootNode", "(", ")", ";", "if", "(", "rootNode", "==", "null", ")", "{", "return", "new", "MultiTextEdit", "(", ")", ";", "}", "char", "[", "]", "content", "=", "document", ".", "get", "(", ")", ".", "toCharArray", "(", ")", ";", "LineInformation", "lineInfo", "=", "LineInformation", ".", "create", "(", "document", ")", ";", "String", "lineDelim", "=", "TextUtilities", ".", "getDefaultLineDelimiter", "(", "document", ")", ";", "ASTNode", "astRoot", "=", "rootNode", ".", "getRoot", "(", ")", ";", "List", "commentNodes", "=", "astRoot", "instanceof", "CompilationUnit", "?", "(", "(", "CompilationUnit", ")", "astRoot", ")", ".", "getCommentList", "(", ")", ":", "null", ";", "Map", "currentOptions", "=", "options", "==", "null", "?", "JavaCore", ".", "getOptions", "(", ")", ":", "options", ";", "return", "internalRewriteAST", "(", "content", ",", "lineInfo", ",", "lineDelim", ",", "commentNodes", ",", "currentOptions", ",", "rootNode", ",", "(", "RecoveryScannerData", ")", "(", "(", "CompilationUnit", ")", "astRoot", ")", ".", "getStatementsRecoveryData", "(", ")", ")", ";", "}", "public", "TextEdit", "rewriteAST", "(", ")", "throws", "JavaModelException", ",", "IllegalArgumentException", "{", "ASTNode", "rootNode", "=", "getRootNode", "(", ")", ";", "if", "(", "rootNode", "==", "null", ")", "{", "return", "new", "MultiTextEdit", "(", ")", ";", "}", "ASTNode", "root", "=", "rootNode", ".", "getRoot", "(", ")", ";", "if", "(", "!", "(", "root", "instanceof", "CompilationUnit", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "CompilationUnit", "astRoot", "=", "(", "CompilationUnit", ")", "root", ";", "ITypeRoot", "typeRoot", "=", "astRoot", ".", "getTypeRoot", "(", ")", ";", "if", "(", "typeRoot", "==", "null", "||", "typeRoot", ".", "getBuffer", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "char", "[", "]", "content", "=", "typeRoot", ".", "getBuffer", "(", ")", ".", "getCharacters", "(", ")", ";", "LineInformation", "lineInfo", "=", "LineInformation", ".", "create", "(", "astRoot", ")", ";", "String", "lineDelim", "=", "typeRoot", ".", "findRecommendedLineSeparator", "(", ")", ";", "Map", "options", "=", "typeRoot", ".", "getJavaProject", "(", ")", ".", "getOptions", "(", "true", ")", ";", "return", "internalRewriteAST", "(", "content", ",", "lineInfo", ",", "lineDelim", ",", "astRoot", ".", "getCommentList", "(", ")", ",", "options", ",", "rootNode", ",", "(", "RecoveryScannerData", ")", "astRoot", ".", "getStatementsRecoveryData", "(", ")", ")", ";", "}", "private", "TextEdit", "internalRewriteAST", "(", "char", "[", "]", "content", ",", "LineInformation", "lineInfo", ",", "String", "lineDelim", ",", "List", "commentNodes", ",", "Map", "options", ",", "ASTNode", "rootNode", ",", "RecoveryScannerData", "recoveryScannerData", ")", "{", "TextEdit", "result", "=", "new", "MultiTextEdit", "(", ")", ";", "TargetSourceRangeComputer", "sourceRangeComputer", "=", "getExtendedSourceRangeComputer", "(", ")", ";", "this", ".", "eventStore", ".", "prepareMovedNodes", "(", "sourceRangeComputer", ")", ";", "ASTRewriteAnalyzer", "visitor", "=", "new", "ASTRewriteAnalyzer", "(", "content", ",", "lineInfo", ",", "lineDelim", ",", "result", ",", "this", ".", "eventStore", ",", "this", ".", "nodeStore", ",", "commentNodes", ",", "options", ",", "sourceRangeComputer", ",", "recoveryScannerData", ")", ";", "rootNode", ".", "accept", "(", "visitor", ")", ";", "this", ".", "eventStore", ".", "revertMovedNodes", "(", ")", ";", "return", "result", ";", "}", "private", "ASTNode", "getRootNode", "(", ")", "{", "ASTNode", "node", "=", "null", ";", "int", "start", "=", "-", "1", ";", "int", "end", "=", "-", "1", ";", "for", "(", "Iterator", "iter", "=", "getRewriteEventStore", "(", ")", ".", "getChangeRootIterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "curr", "=", "(", "ASTNode", ")", "iter", ".", "next", "(", ")", ";", "if", "(", "!", "RewriteEventStore", ".", "isNewNode", "(", "curr", ")", ")", "{", "int", "currStart", "=", "curr", ".", "getStartPosition", "(", ")", ";", "int", "currEnd", "=", "currStart", "+", "curr", ".", "getLength", "(", ")", ";", "if", "(", "node", "==", "null", "||", "currStart", "<", "start", "&&", "currEnd", ">", "end", ")", "{", "start", "=", "currStart", ";", "end", "=", "currEnd", ";", "node", "=", "curr", ";", "}", "else", "if", "(", "currStart", "<", "start", ")", "{", "start", "=", "currStart", ";", "}", "else", "if", "(", "currEnd", ">", "end", ")", "{", "end", "=", "currEnd", ";", "}", "}", "}", "if", "(", "node", "!=", "null", ")", "{", "int", "currStart", "=", "node", ".", "getStartPosition", "(", ")", ";", "int", "currEnd", "=", "currStart", "+", "node", ".", "getLength", "(", ")", ";", "while", "(", "start", "<", "currStart", "||", "end", ">", "currEnd", ")", "{", "node", "=", "node", ".", "getParent", "(", ")", ";", "currStart", "=", "node", ".", "getStartPosition", "(", ")", ";", "currEnd", "=", "currStart", "+", "node", ".", "getLength", "(", ")", ";", "}", "ASTNode", "parent", "=", "node", ".", "getParent", "(", ")", ";", "while", "(", "parent", "!=", "null", "&&", "parent", ".", "getStartPosition", "(", ")", "==", "node", ".", "getStartPosition", "(", ")", "&&", "parent", ".", "getLength", "(", ")", "==", "node", ".", "getLength", "(", ")", ")", "{", "node", "=", "parent", ";", "parent", "=", "node", ".", "getParent", "(", ")", ";", "}", "}", "return", "node", ";", "}", "public", "final", "void", "remove", "(", "ASTNode", "node", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "StructuralPropertyDescriptor", "property", ";", "ASTNode", "parent", ";", "if", "(", "RewriteEventStore", ".", "isNewNode", "(", "node", ")", ")", "{", "PropertyLocation", "location", "=", "this", ".", "eventStore", ".", "getPropertyLocation", "(", "node", ",", "RewriteEventStore", ".", "NEW", ")", ";", "if", "(", "location", "!=", "null", ")", "{", "property", "=", "location", ".", "getProperty", "(", ")", ";", "parent", "=", "location", ".", "getParent", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "else", "{", "property", "=", "node", ".", "getLocationInParent", "(", ")", ";", "parent", "=", "node", ".", "getParent", "(", ")", ";", "}", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "getListRewrite", "(", "parent", ",", "(", "ChildListPropertyDescriptor", ")", "property", ")", ".", "remove", "(", "node", ",", "editGroup", ")", ";", "}", "else", "{", "set", "(", "parent", ",", "property", ",", "null", ",", "editGroup", ")", ";", "}", "}", "public", "final", "void", "replace", "(", "ASTNode", "node", ",", "ASTNode", "replacement", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "StructuralPropertyDescriptor", "property", ";", "ASTNode", "parent", ";", "if", "(", "RewriteEventStore", ".", "isNewNode", "(", "node", ")", ")", "{", "PropertyLocation", "location", "=", "this", ".", "eventStore", ".", "getPropertyLocation", "(", "node", ",", "RewriteEventStore", ".", "NEW", ")", ";", "if", "(", "location", "!=", "null", ")", "{", "property", "=", "location", ".", "getProperty", "(", ")", ";", "parent", "=", "location", ".", "getParent", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "else", "{", "property", "=", "node", ".", "getLocationInParent", "(", ")", ";", "parent", "=", "node", ".", "getParent", "(", ")", ";", "}", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "getListRewrite", "(", "parent", ",", "(", "ChildListPropertyDescriptor", ")", "property", ")", ".", "replace", "(", "node", ",", "replacement", ",", "editGroup", ")", ";", "}", "else", "{", "set", "(", "parent", ",", "property", ",", "replacement", ",", "editGroup", ")", ";", "}", "}", "public", "final", "void", "set", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ",", "Object", "value", ",", "TextEditGroup", "editGroup", ")", "{", "if", "(", "node", "==", "null", "||", "property", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "validateIsCorrectAST", "(", "node", ")", ";", "validatePropertyType", "(", "property", ",", "value", ")", ";", "validateIsPropertyOfNode", "(", "property", ",", "node", ")", ";", "NodeRewriteEvent", "nodeEvent", "=", "this", ".", "eventStore", ".", "getNodeEvent", "(", "node", ",", "property", ",", "true", ")", ";", "nodeEvent", ".", "setNewValue", "(", "value", ")", ";", "if", "(", "editGroup", "!=", "null", ")", "{", "this", ".", "eventStore", ".", "setEventEditGroup", "(", "nodeEvent", ",", "editGroup", ")", ";", "}", "}", "public", "Object", "get", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "node", "==", "null", "||", "property", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "return", "this", ".", "eventStore", ".", "getNewValue", "(", "node", ",", "property", ")", ";", "}", "public", "final", "ListRewrite", "getListRewrite", "(", "ASTNode", "node", ",", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "node", "==", "null", "||", "property", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "validateIsCorrectAST", "(", "node", ")", ";", "validateIsListProperty", "(", "property", ")", ";", "validateIsPropertyOfNode", "(", "property", ",", "node", ")", ";", "return", "new", "ListRewrite", "(", "this", ",", "node", ",", "property", ")", ";", "}", "public", "final", "Object", "getProperty", "(", "String", "propertyName", ")", "{", "if", "(", "propertyName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "property1", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "property1", "instanceof", "String", ")", "{", "if", "(", "propertyName", ".", "equals", "(", "this", ".", "property1", ")", ")", "{", "return", "this", ".", "property2", ";", "}", "else", "{", "return", "null", ";", "}", "}", "Map", "m", "=", "(", "Map", ")", "this", ".", "property1", ";", "return", "m", ".", "get", "(", "propertyName", ")", ";", "}", "public", "final", "ITrackedNodePosition", "track", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "TextEditGroup", "group", "=", "this", ".", "eventStore", ".", "getTrackedNodeData", "(", "node", ")", ";", "if", "(", "group", "==", "null", ")", "{", "group", "=", "new", "TextEditGroup", "(", "\"internal\"", ")", ";", "this", ".", "eventStore", ".", "setTrackedNodeData", "(", "node", ",", "group", ")", ";", "}", "return", "new", "TrackedNodePosition", "(", "group", ",", "node", ")", ";", "}", "private", "void", "validateIsExistingNode", "(", "ASTNode", "node", ")", "{", "if", "(", "node", ".", "getStartPosition", "(", ")", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "private", "void", "validateIsCorrectAST", "(", "ASTNode", "node", ")", "{", "if", "(", "node", ".", "getAST", "(", ")", "!=", "getAST", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "private", "void", "validateIsListProperty", "(", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "!", "property", ".", "isChildListProperty", "(", ")", ")", "{", "String", "message", "=", "property", ".", "getId", "(", ")", "+", "\"\"", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "private", "void", "validateIsPropertyOfNode", "(", "StructuralPropertyDescriptor", "property", ",", "ASTNode", "node", ")", "{", "if", "(", "!", "property", ".", "getNodeClass", "(", ")", ".", "isInstance", "(", "node", ")", ")", "{", "String", "message", "=", "property", ".", "getId", "(", ")", "+", "\"\"", "+", "node", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "private", "void", "validatePropertyType", "(", "StructuralPropertyDescriptor", "prop", ",", "Object", "node", ")", "{", "if", "(", "prop", ".", "isChildListProperty", "(", ")", ")", "{", "String", "message", "=", "\"\"", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}", "public", "final", "ASTNode", "createStringPlaceholder", "(", "String", "code", ",", "int", "nodeType", ")", "{", "if", "(", "code", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "placeholder", "=", "getNodeStore", "(", ")", ".", "newPlaceholderNode", "(", "nodeType", ")", ";", "if", "(", "placeholder", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "nodeType", ")", ";", "}", "getNodeStore", "(", ")", ".", "markAsStringPlaceholder", "(", "placeholder", ",", "code", ")", ";", "return", "placeholder", ";", "}", "public", "final", "ASTNode", "createGroupNode", "(", "ASTNode", "[", "]", "targetNodes", ")", "{", "if", "(", "targetNodes", "==", "null", "||", "targetNodes", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "Block", "res", "=", "getNodeStore", "(", ")", ".", "createCollapsePlaceholder", "(", ")", ";", "ListRewrite", "listRewrite", "=", "getListRewrite", "(", "res", ",", "Block", ".", "STATEMENTS_PROPERTY", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "targetNodes", ".", "length", ";", "i", "++", ")", "{", "listRewrite", ".", "insertLast", "(", "targetNodes", "[", "i", "]", ",", "null", ")", ";", "}", "return", "res", ";", "}", "private", "ASTNode", "createTargetNode", "(", "ASTNode", "node", ",", "boolean", "isMove", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "validateIsExistingNode", "(", "node", ")", ";", "validateIsCorrectAST", "(", "node", ")", ";", "CopySourceInfo", "info", "=", "getRewriteEventStore", "(", ")", ".", "markAsCopySource", "(", "node", ".", "getParent", "(", ")", ",", "node", ".", "getLocationInParent", "(", ")", ",", "node", ",", "isMove", ")", ";", "ASTNode", "placeholder", "=", "getNodeStore", "(", ")", ".", "newPlaceholderNode", "(", "node", ".", "getNodeType", "(", ")", ")", ";", "if", "(", "placeholder", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "node", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "getNodeStore", "(", ")", ".", "markAsCopyTarget", "(", "placeholder", ",", "info", ")", ";", "return", "placeholder", ";", "}", "public", "final", "ASTNode", "createCopyTarget", "(", "ASTNode", "node", ")", "{", "return", "createTargetNode", "(", "node", ",", "false", ")", ";", "}", "public", "final", "ASTNode", "createMoveTarget", "(", "ASTNode", "node", ")", "{", "return", "createTargetNode", "(", "node", ",", "true", ")", ";", "}", "public", "final", "TargetSourceRangeComputer", "getExtendedSourceRangeComputer", "(", ")", "{", "if", "(", "this", ".", "targetSourceRangeComputer", "==", "null", ")", "{", "this", ".", "targetSourceRangeComputer", "=", "new", "TargetSourceRangeComputer", "(", ")", ";", "}", "return", "this", ".", "targetSourceRangeComputer", ";", "}", "public", "final", "void", "setProperty", "(", "String", "propertyName", ",", "Object", "data", ")", "{", "if", "(", "propertyName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "property1", "==", "null", ")", "{", "if", "(", "data", "==", "null", ")", "{", "return", ";", "}", "this", ".", "property1", "=", "propertyName", ";", "this", ".", "property2", "=", "data", ";", "return", ";", "}", "if", "(", "this", ".", "property1", "instanceof", "String", ")", "{", "if", "(", "propertyName", ".", "equals", "(", "this", ".", "property1", ")", ")", "{", "if", "(", "data", "==", "null", ")", "{", "this", ".", "property1", "=", "null", ";", "this", ".", "property2", "=", "null", ";", "}", "else", "{", "this", ".", "property2", "=", "data", ";", "}", "return", ";", "}", "if", "(", "data", "==", "null", ")", "{", "return", ";", "}", "Map", "m", "=", "new", "HashMap", "(", "3", ")", ";", "m", ".", "put", "(", "this", ".", "property1", ",", "this", ".", "property2", ")", ";", "m", ".", "put", "(", "propertyName", ",", "data", ")", ";", "this", ".", "property1", "=", "m", ";", "this", ".", "property2", "=", "null", ";", "return", ";", "}", "Map", "m", "=", "(", "Map", ")", "this", ".", "property1", ";", "if", "(", "data", "==", "null", ")", "{", "m", ".", "remove", "(", "propertyName", ")", ";", "if", "(", "m", ".", "size", "(", ")", "==", "1", ")", "{", "Map", ".", "Entry", "[", "]", "entries", "=", "(", "Map", ".", "Entry", "[", "]", ")", "m", ".", "entrySet", "(", ")", ".", "toArray", "(", "new", "Map", ".", "Entry", "[", "1", "]", ")", ";", "this", ".", "property1", "=", "entries", "[", "0", "]", ".", "getKey", "(", ")", ";", "this", ".", "property2", "=", "entries", "[", "0", "]", ".", "getValue", "(", ")", ";", "}", "return", ";", "}", "else", "{", "m", ".", "put", "(", "propertyName", ",", "data", ")", ";", "return", ";", "}", "}", "public", "final", "void", "setTargetSourceRangeComputer", "(", "TargetSourceRangeComputer", "computer", ")", "{", "this", ".", "targetSourceRangeComputer", "=", "computer", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "\"Events:n\"", ")", ";", "if", "(", "this", ".", "eventStore", "!=", "null", ")", "{", "buf", ".", "append", "(", "this", ".", "eventStore", ".", "toString", "(", ")", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,376
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ThrowStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ThrowStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "ThrowStatement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "expression", "=", "null", ";", "ThrowStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "THROW_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ThrowStatement", "result", "=", "new", "ThrowStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "getExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "expression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "expression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "expression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "expression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "expression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,377
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "NullLiteral", "extends", "Expression", "{", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "1", ")", ";", "createPropertyList", "(", "NullLiteral", ".", "class", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "NullLiteral", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "NULL_LITERAL", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "NullLiteral", "result", "=", "new", "NullLiteral", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "visitor", ".", "visit", "(", "this", ")", ";", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", ";", "}", "}", "</s>" ]
2,378
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "TypeDeclaration", "extends", "AbstractTypeDeclaration", "{", "public", "static", "final", "ChildPropertyDescriptor", "JAVADOC_PROPERTY", "=", "internalJavadocPropertyFactory", "(", "TypeDeclaration", ".", "class", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "MODIFIERS_PROPERTY", "=", "internalModifiersPropertyFactory", "(", "TypeDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "MODIFIERS2_PROPERTY", "=", "internalModifiers2PropertyFactory", "(", "TypeDeclaration", ".", "class", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "INTERFACE_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"interface\"", ",", "boolean", ".", "class", ",", "MANDATORY", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "internalNamePropertyFactory", "(", "TypeDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "SUPERCLASS_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"superclass\"", ",", "Name", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "SUPER_INTERFACES_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"\"", ",", "Name", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "SUPERCLASS_TYPE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"\"", ",", "Type", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "SUPER_INTERFACE_TYPES_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"\"", ",", "Type", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "TYPE_PARAMETERS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "TypeDeclaration", ".", "class", ",", "\"\"", ",", "TypeParameter", ".", "class", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "BODY_DECLARATIONS_PROPERTY", "=", "internalBodyDeclarationPropertyFactory", "(", "TypeDeclaration", ".", "class", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "8", ")", ";", "createPropertyList", "(", "TypeDeclaration", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "MODIFIERS_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "INTERFACE_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "SUPERCLASS_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "SUPER_INTERFACES_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "BODY_DECLARATIONS_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "propertyList", "=", "new", "ArrayList", "(", "9", ")", ";", "createPropertyList", "(", "TypeDeclaration", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "MODIFIERS2_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "INTERFACE_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_PARAMETERS_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "SUPERCLASS_TYPE_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "SUPER_INTERFACE_TYPES_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "BODY_DECLARATIONS_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "boolean", "isInterface", "=", "false", ";", "private", "ASTNode", ".", "NodeList", "typeParameters", "=", "null", ";", "private", "Name", "optionalSuperclassName", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "superInterfaceNames", "=", "null", ";", "private", "Type", "optionalSuperclassType", "=", "null", ";", "private", "ASTNode", ".", "NodeList", "superInterfaceTypes", "=", "null", ";", "TypeDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "if", "(", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "this", ".", "superInterfaceNames", "=", "new", "ASTNode", ".", "NodeList", "(", "SUPER_INTERFACES_PROPERTY", ")", ";", "}", "if", "(", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "this", ".", "typeParameters", "=", "new", "ASTNode", ".", "NodeList", "(", "TYPE_PARAMETERS_PROPERTY", ")", ";", "this", ".", "superInterfaceTypes", "=", "new", "ASTNode", ".", "NodeList", "(", "SUPER_INTERFACE_TYPES_PROPERTY", ")", ";", "}", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "int", "internalGetSetIntProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "int", "value", ")", "{", "if", "(", "property", "==", "MODIFIERS_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getModifiers", "(", ")", ";", "}", "else", "{", "internalSetModifiers", "(", "value", ")", ";", "return", "0", ";", "}", "}", "return", "super", ".", "internalGetSetIntProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "boolean", "internalGetSetBooleanProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "boolean", "value", ")", "{", "if", "(", "property", "==", "INTERFACE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "isInterface", "(", ")", ";", "}", "else", "{", "setInterface", "(", "value", ")", ";", "return", "false", ";", "}", "}", "return", "super", ".", "internalGetSetBooleanProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "JAVADOC_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getJavadoc", "(", ")", ";", "}", "else", "{", "setJavadoc", "(", "(", "Javadoc", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "SUPERCLASS_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getSuperclass", "(", ")", ";", "}", "else", "{", "setSuperclass", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "SUPERCLASS_TYPE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getSuperclassType", "(", ")", ";", "}", "else", "{", "setSuperclassType", "(", "(", "Type", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "MODIFIERS2_PROPERTY", ")", "{", "return", "modifiers", "(", ")", ";", "}", "if", "(", "property", "==", "TYPE_PARAMETERS_PROPERTY", ")", "{", "return", "typeParameters", "(", ")", ";", "}", "if", "(", "property", "==", "SUPER_INTERFACES_PROPERTY", ")", "{", "return", "superInterfaces", "(", ")", ";", "}", "if", "(", "property", "==", "SUPER_INTERFACE_TYPES_PROPERTY", ")", "{", "return", "superInterfaceTypes", "(", ")", ";", "}", "if", "(", "property", "==", "BODY_DECLARATIONS_PROPERTY", ")", "{", "return", "bodyDeclarations", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalJavadocProperty", "(", ")", "{", "return", "JAVADOC_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalModifiers2Property", "(", ")", "{", "return", "MODIFIERS2_PROPERTY", ";", "}", "final", "SimplePropertyDescriptor", "internalModifiersProperty", "(", ")", "{", "return", "MODIFIERS_PROPERTY", ";", "}", "final", "ChildPropertyDescriptor", "internalNameProperty", "(", ")", "{", "return", "NAME_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalBodyDeclarationsProperty", "(", ")", "{", "return", "BODY_DECLARATIONS_PROPERTY", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "TYPE_DECLARATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "TypeDeclaration", "result", "=", "new", "TypeDeclaration", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setJavadoc", "(", "(", "Javadoc", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getJavadoc", "(", ")", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "result", ".", "internalSetModifiers", "(", "getModifiers", "(", ")", ")", ";", "result", ".", "setSuperclass", "(", "(", "Name", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getSuperclass", "(", ")", ")", ")", ";", "result", ".", "superInterfaces", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "superInterfaces", "(", ")", ")", ")", ";", "}", "result", ".", "setInterface", "(", "isInterface", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "result", ".", "modifiers", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "modifiers", "(", ")", ")", ")", ";", "result", ".", "typeParameters", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "typeParameters", "(", ")", ")", ")", ";", "result", ".", "setSuperclassType", "(", "(", "Type", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getSuperclassType", "(", ")", ")", ")", ";", "result", ".", "superInterfaceTypes", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "superInterfaceTypes", "(", ")", ")", ")", ";", "}", "result", ".", "bodyDeclarations", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "bodyDeclarations", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "if", "(", "this", ".", "ast", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "acceptChild", "(", "visitor", ",", "getJavadoc", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getSuperclass", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "superInterfaceNames", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "bodyDeclarations", ")", ";", "}", "if", "(", "this", ".", "ast", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "acceptChild", "(", "visitor", ",", "getJavadoc", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "modifiers", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "typeParameters", ")", ";", "acceptChild", "(", "visitor", ",", "getSuperclassType", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "superInterfaceTypes", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "bodyDeclarations", ")", ";", "}", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "boolean", "isInterface", "(", ")", "{", "return", "this", ".", "isInterface", ";", "}", "public", "void", "setInterface", "(", "boolean", "isInterface", ")", "{", "preValueChange", "(", "INTERFACE_PROPERTY", ")", ";", "this", ".", "isInterface", "=", "isInterface", ";", "postValueChange", "(", "INTERFACE_PROPERTY", ")", ";", "}", "public", "List", "typeParameters", "(", ")", "{", "if", "(", "this", ".", "typeParameters", "==", "null", ")", "{", "unsupportedIn2", "(", ")", ";", "}", "return", "this", ".", "typeParameters", ";", "}", "public", "Name", "getSuperclass", "(", ")", "{", "return", "internalGetSuperclass", "(", ")", ";", "}", "final", "Name", "internalGetSuperclass", "(", ")", "{", "supportedOnlyIn2", "(", ")", ";", "return", "this", ".", "optionalSuperclassName", ";", "}", "public", "Type", "getSuperclassType", "(", ")", "{", "unsupportedIn2", "(", ")", ";", "return", "this", ".", "optionalSuperclassType", ";", "}", "public", "void", "setSuperclass", "(", "Name", "superclassName", ")", "{", "internalSetSuperclass", "(", "superclassName", ")", ";", "}", "final", "void", "internalSetSuperclass", "(", "Name", "superclassName", ")", "{", "supportedOnlyIn2", "(", ")", ";", "ASTNode", "oldChild", "=", "this", ".", "optionalSuperclassName", ";", "preReplaceChild", "(", "oldChild", ",", "superclassName", ",", "SUPERCLASS_PROPERTY", ")", ";", "this", ".", "optionalSuperclassName", "=", "superclassName", ";", "postReplaceChild", "(", "oldChild", ",", "superclassName", ",", "SUPERCLASS_PROPERTY", ")", ";", "}", "public", "void", "setSuperclassType", "(", "Type", "superclassType", ")", "{", "unsupportedIn2", "(", ")", ";", "ASTNode", "oldChild", "=", "this", ".", "optionalSuperclassType", ";", "preReplaceChild", "(", "oldChild", ",", "superclassType", ",", "SUPERCLASS_TYPE_PROPERTY", ")", ";", "this", ".", "optionalSuperclassType", "=", "superclassType", ";", "postReplaceChild", "(", "oldChild", ",", "superclassType", ",", "SUPERCLASS_TYPE_PROPERTY", ")", ";", "}", "public", "List", "superInterfaces", "(", ")", "{", "return", "internalSuperInterfaces", "(", ")", ";", "}", "final", "List", "internalSuperInterfaces", "(", ")", "{", "if", "(", "this", ".", "superInterfaceNames", "==", "null", ")", "{", "supportedOnlyIn2", "(", ")", ";", "}", "return", "this", ".", "superInterfaceNames", ";", "}", "public", "List", "superInterfaceTypes", "(", ")", "{", "if", "(", "this", ".", "superInterfaceTypes", "==", "null", ")", "{", "unsupportedIn2", "(", ")", ";", "}", "return", "this", ".", "superInterfaceTypes", ";", "}", "public", "FieldDeclaration", "[", "]", "getFields", "(", ")", "{", "List", "bd", "=", "bodyDeclarations", "(", ")", ";", "int", "fieldCount", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "if", "(", "it", ".", "next", "(", ")", "instanceof", "FieldDeclaration", ")", "{", "fieldCount", "++", ";", "}", "}", "FieldDeclaration", "[", "]", "fields", "=", "new", "FieldDeclaration", "[", "fieldCount", "]", ";", "int", "next", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "decl", "=", "it", ".", "next", "(", ")", ";", "if", "(", "decl", "instanceof", "FieldDeclaration", ")", "{", "fields", "[", "next", "++", "]", "=", "(", "FieldDeclaration", ")", "decl", ";", "}", "}", "return", "fields", ";", "}", "public", "MethodDeclaration", "[", "]", "getMethods", "(", ")", "{", "List", "bd", "=", "bodyDeclarations", "(", ")", ";", "int", "methodCount", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "if", "(", "it", ".", "next", "(", ")", "instanceof", "MethodDeclaration", ")", "{", "methodCount", "++", ";", "}", "}", "MethodDeclaration", "[", "]", "methods", "=", "new", "MethodDeclaration", "[", "methodCount", "]", ";", "int", "next", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "decl", "=", "it", ".", "next", "(", ")", ";", "if", "(", "decl", "instanceof", "MethodDeclaration", ")", "{", "methods", "[", "next", "++", "]", "=", "(", "MethodDeclaration", ")", "decl", ";", "}", "}", "return", "methods", ";", "}", "public", "TypeDeclaration", "[", "]", "getTypes", "(", ")", "{", "List", "bd", "=", "bodyDeclarations", "(", ")", ";", "int", "typeCount", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "if", "(", "it", ".", "next", "(", ")", "instanceof", "TypeDeclaration", ")", "{", "typeCount", "++", ";", "}", "}", "TypeDeclaration", "[", "]", "memberTypes", "=", "new", "TypeDeclaration", "[", "typeCount", "]", ";", "int", "next", "=", "0", ";", "for", "(", "Iterator", "it", "=", "bd", ".", "listIterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "decl", "=", "it", ".", "next", "(", ")", ";", "if", "(", "decl", "instanceof", "TypeDeclaration", ")", "{", "memberTypes", "[", "next", "++", "]", "=", "(", "TypeDeclaration", ")", "decl", ";", "}", "}", "return", "memberTypes", ";", "}", "ITypeBinding", "internalResolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveType", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "6", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalDocComment", "==", "null", "?", "0", ":", "getJavadoc", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "modifiers", "==", "null", "?", "0", ":", "this", ".", "modifiers", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "typeParameters", "==", "null", "?", "0", ":", "this", ".", "typeParameters", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "optionalSuperclassName", "==", "null", "?", "0", ":", "getSuperclass", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalSuperclassType", "==", "null", "?", "0", ":", "getSuperclassType", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "superInterfaceNames", "==", "null", "?", "0", ":", "this", ".", "superInterfaceNames", ".", "listSize", "(", ")", ")", "+", "(", "this", ".", "superInterfaceTypes", "==", "null", "?", "0", ":", "this", ".", "superInterfaceTypes", ".", "listSize", "(", ")", ")", "+", "this", ".", "bodyDeclarations", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,379
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "public", "class", "StringLiteral", "extends", "Expression", "{", "public", "static", "final", "SimplePropertyDescriptor", "ESCAPED_VALUE_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "StringLiteral", ".", "class", ",", "\"escapedValue\"", ",", "String", ".", "class", ",", "MANDATORY", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "StringLiteral", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "ESCAPED_VALUE_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "String", "escapedValue", "=", "\"\\\"\\\"\"", ";", "StringLiteral", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "Object", "internalGetSetObjectProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "Object", "value", ")", "{", "if", "(", "property", "==", "ESCAPED_VALUE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getEscapedValue", "(", ")", ";", "}", "else", "{", "setEscapedValue", "(", "(", "String", ")", "value", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetObjectProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "STRING_LITERAL", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "StringLiteral", "result", "=", "new", "StringLiteral", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setEscapedValue", "(", "getEscapedValue", "(", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "visitor", ".", "visit", "(", "this", ")", ";", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "String", "getEscapedValue", "(", ")", "{", "return", "this", ".", "escapedValue", ";", "}", "public", "void", "setEscapedValue", "(", "String", "token", ")", "{", "if", "(", "token", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "Scanner", "scanner", "=", "this", ".", "ast", ".", "scanner", ";", "char", "[", "]", "source", "=", "token", ".", "toCharArray", "(", ")", ";", "scanner", ".", "setSource", "(", "source", ")", ";", "scanner", ".", "resetTo", "(", "0", ",", "source", ".", "length", ")", ";", "try", "{", "int", "tokenType", "=", "scanner", ".", "getNextToken", "(", ")", ";", "switch", "(", "tokenType", ")", "{", "case", "TerminalTokens", ".", "TokenNameStringLiteral", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "token", "+", "\"<\"", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "token", "+", "\"<\"", ")", ";", "}", "preValueChange", "(", "ESCAPED_VALUE_PROPERTY", ")", ";", "this", ".", "escapedValue", "=", "token", ";", "postValueChange", "(", "ESCAPED_VALUE_PROPERTY", ")", ";", "}", "void", "internalSetEscapedValue", "(", "String", "token", ")", "{", "preValueChange", "(", "ESCAPED_VALUE_PROPERTY", ")", ";", "this", ".", "escapedValue", "=", "token", ";", "postValueChange", "(", "ESCAPED_VALUE_PROPERTY", ")", ";", "}", "public", "String", "getLiteralValue", "(", ")", "{", "String", "s", "=", "getEscapedValue", "(", ")", ";", "int", "len", "=", "s", ".", "length", "(", ")", ";", "if", "(", "len", "<", "2", "||", "s", ".", "charAt", "(", "0", ")", "!=", "'\\\"'", "||", "s", ".", "charAt", "(", "len", "-", "1", ")", "!=", "'\\\"'", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "Scanner", "scanner", "=", "this", ".", "ast", ".", "scanner", ";", "char", "[", "]", "source", "=", "s", ".", "toCharArray", "(", ")", ";", "scanner", ".", "setSource", "(", "source", ")", ";", "scanner", ".", "resetTo", "(", "0", ",", "source", ".", "length", ")", ";", "try", "{", "int", "tokenType", "=", "scanner", ".", "getNextToken", "(", ")", ";", "switch", "(", "tokenType", ")", "{", "case", "TerminalTokens", ".", "TokenNameStringLiteral", ":", "return", "scanner", ".", "getCurrentStringLiteral", "(", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "public", "void", "setLiteralValue", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "int", "len", "=", "value", ".", "length", "(", ")", ";", "StringBuffer", "b", "=", "new", "StringBuffer", "(", "len", "+", "2", ")", ";", "b", ".", "append", "(", "\"\\\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "char", "c", "=", "value", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'\\b'", ":", "b", ".", "append", "(", "\"\\\\b\"", ")", ";", "break", ";", "case", "'\\t'", ":", "b", ".", "append", "(", "\"\\\\t\"", ")", ";", "break", ";", "case", "'\\n'", ":", "b", ".", "append", "(", "\"\\\\n\"", ")", ";", "break", ";", "case", "'\\f'", ":", "b", ".", "append", "(", "\"\\\\f\"", ")", ";", "break", ";", "case", "'\\r'", ":", "b", ".", "append", "(", "\"\\\\r\"", ")", ";", "break", ";", "case", "'\\\"'", ":", "b", ".", "append", "(", "\"\\\\\\\"\"", ")", ";", "break", ";", "case", "'\\\\'", ":", "b", ".", "append", "(", "\"\\\\\\\\\"", ")", ";", "break", ";", "case", "'\\0'", ":", "b", ".", "append", "(", "\"\\\\0\"", ")", ";", "break", ";", "case", "'\\1'", ":", "b", ".", "append", "(", "\"\\\\1\"", ")", ";", "break", ";", "case", "'\\2'", ":", "b", ".", "append", "(", "\"\\\\2\"", ")", ";", "break", ";", "case", "'\\3'", ":", "b", ".", "append", "(", "\"\\\\3\"", ")", ";", "break", ";", "case", "'\\4'", ":", "b", ".", "append", "(", "\"\\\\4\"", ")", ";", "break", ";", "case", "'\\5'", ":", "b", ".", "append", "(", "\"\\\\5\"", ")", ";", "break", ";", "case", "'\\6'", ":", "b", ".", "append", "(", "\"\\\\6\"", ")", ";", "break", ";", "case", "'\\7'", ":", "b", ".", "append", "(", "\"\\\\7\"", ")", ";", "break", ";", "default", ":", "b", ".", "append", "(", "c", ")", ";", "}", "}", "b", ".", "append", "(", "\"\\\"\"", ")", ";", "setEscapedValue", "(", "b", ".", "toString", "(", ")", ")", ";", "}", "int", "memSize", "(", ")", "{", "int", "size", "=", "BASE_NODE_SIZE", "+", "1", "*", "4", "+", "stringSize", "(", "this", ".", "escapedValue", ")", ";", "return", "size", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", ";", "}", "}", "</s>" ]
2,380
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "abstract", "class", "VariableDeclaration", "extends", "ASTNode", "{", "abstract", "SimplePropertyDescriptor", "internalExtraDimensionsProperty", "(", ")", ";", "public", "final", "SimplePropertyDescriptor", "getExtraDimensionsProperty", "(", ")", "{", "return", "internalExtraDimensionsProperty", "(", ")", ";", "}", "abstract", "ChildPropertyDescriptor", "internalInitializerProperty", "(", ")", ";", "public", "final", "ChildPropertyDescriptor", "getInitializerProperty", "(", ")", "{", "return", "internalInitializerProperty", "(", ")", ";", "}", "abstract", "ChildPropertyDescriptor", "internalNameProperty", "(", ")", ";", "public", "final", "ChildPropertyDescriptor", "getNameProperty", "(", ")", "{", "return", "internalNameProperty", "(", ")", ";", "}", "VariableDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "public", "abstract", "SimpleName", "getName", "(", ")", ";", "public", "abstract", "void", "setName", "(", "SimpleName", "variableName", ")", ";", "public", "abstract", "int", "getExtraDimensions", "(", ")", ";", "public", "abstract", "void", "setExtraDimensions", "(", "int", "dimensions", ")", ";", "public", "abstract", "Expression", "getInitializer", "(", ")", ";", "public", "abstract", "void", "setInitializer", "(", "Expression", "initializer", ")", ";", "public", "IVariableBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveVariable", "(", "this", ")", ";", "}", "}", "</s>" ]
2,381
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "AnnotationTypeMemberDeclaration", "extends", "BodyDeclaration", "{", "public", "static", "final", "ChildPropertyDescriptor", "JAVADOC_PROPERTY", "=", "internalJavadocPropertyFactory", "(", "AnnotationTypeMemberDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildListPropertyDescriptor", "MODIFIERS2_PROPERTY", "=", "internalModifiers2PropertyFactory", "(", "AnnotationTypeMemberDeclaration", ".", "class", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "AnnotationTypeMemberDeclaration", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "AnnotationTypeMemberDeclaration", ".", "class", ",", "\"type\"", ",", "Type", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "DEFAULT_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "AnnotationTypeMemberDeclaration", ".", "class", ",", "\"default\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "6", ")", ";", "createPropertyList", "(", "AnnotationTypeMemberDeclaration", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "JAVADOC_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "MODIFIERS2_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "TYPE_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "DEFAULT_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "memberName", "=", "null", ";", "private", "Type", "memberType", "=", "null", ";", "private", "Expression", "optionalDefaultValue", "=", "null", ";", "AnnotationTypeMemberDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "unsupportedIn2", "(", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "JAVADOC_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getJavadoc", "(", ")", ";", "}", "else", "{", "setJavadoc", "(", "(", "Javadoc", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "TYPE_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getType", "(", ")", ";", "}", "else", "{", "setType", "(", "(", "Type", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "DEFAULT_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getDefault", "(", ")", ";", "}", "else", "{", "setDefault", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "MODIFIERS2_PROPERTY", ")", "{", "return", "modifiers", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "ChildPropertyDescriptor", "internalJavadocProperty", "(", ")", "{", "return", "JAVADOC_PROPERTY", ";", "}", "final", "ChildListPropertyDescriptor", "internalModifiers2Property", "(", ")", "{", "return", "MODIFIERS2_PROPERTY", ";", "}", "final", "SimplePropertyDescriptor", "internalModifiersProperty", "(", ")", "{", "return", "null", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ANNOTATION_TYPE_MEMBER_DECLARATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "AnnotationTypeMemberDeclaration", "result", "=", "new", "AnnotationTypeMemberDeclaration", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setJavadoc", "(", "(", "Javadoc", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getJavadoc", "(", ")", ")", ")", ";", "result", ".", "modifiers", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "modifiers", "(", ")", ")", ")", ";", "result", ".", "setType", "(", "(", "Type", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getType", "(", ")", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setDefault", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getDefault", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getJavadoc", "(", ")", ")", ";", "acceptChildren", "(", "visitor", ",", "this", ".", "modifiers", ")", ";", "acceptChild", "(", "visitor", ",", "getType", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getDefault", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "memberName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "memberName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "memberName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "memberName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "memberName", ";", "}", "public", "void", "setName", "(", "SimpleName", "memberName", ")", "{", "if", "(", "memberName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "memberName", ";", "preReplaceChild", "(", "oldChild", ",", "memberName", ",", "NAME_PROPERTY", ")", ";", "this", ".", "memberName", "=", "memberName", ";", "postReplaceChild", "(", "oldChild", ",", "memberName", ",", "NAME_PROPERTY", ")", ";", "}", "public", "Type", "getType", "(", ")", "{", "if", "(", "this", ".", "memberType", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "memberType", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "memberType", "=", "this", ".", "ast", ".", "newPrimitiveType", "(", "PrimitiveType", ".", "INT", ")", ";", "postLazyInit", "(", "this", ".", "memberType", ",", "TYPE_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "memberType", ";", "}", "public", "void", "setType", "(", "Type", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "memberType", ";", "preReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "this", ".", "memberType", "=", "type", ";", "postReplaceChild", "(", "oldChild", ",", "type", ",", "TYPE_PROPERTY", ")", ";", "}", "public", "Expression", "getDefault", "(", ")", "{", "return", "this", ".", "optionalDefaultValue", ";", "}", "public", "void", "setDefault", "(", "Expression", "defaultValue", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalDefaultValue", ";", "preReplaceChild", "(", "oldChild", ",", "defaultValue", ",", "DEFAULT_PROPERTY", ")", ";", "this", ".", "optionalDefaultValue", "=", "defaultValue", ";", "postReplaceChild", "(", "oldChild", ",", "defaultValue", ",", "DEFAULT_PROPERTY", ")", ";", "}", "public", "IMethodBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveMember", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalDocComment", "==", "null", "?", "0", ":", "getJavadoc", "(", ")", ".", "treeSize", "(", ")", ")", "+", "this", ".", "modifiers", ".", "listSize", "(", ")", "+", "(", "this", ".", "memberName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "memberType", "==", "null", "?", "0", ":", "getType", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalDefaultValue", "==", "null", "?", "0", ":", "getDefault", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,382
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "BreakStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "LABEL_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "BreakStatement", ".", "class", ",", "\"label\"", ",", "SimpleName", ".", "class", ",", "OPTIONAL", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "BreakStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "LABEL_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "optionalLabel", "=", "null", ";", "BreakStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "LABEL_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getLabel", "(", ")", ";", "}", "else", "{", "setLabel", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "BREAK_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "BreakStatement", "result", "=", "new", "BreakStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setLabel", "(", "(", "SimpleName", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getLabel", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getLabel", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getLabel", "(", ")", "{", "return", "this", ".", "optionalLabel", ";", "}", "public", "void", "setLabel", "(", "SimpleName", "label", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalLabel", ";", "preReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "this", ".", "optionalLabel", "=", "label", ";", "postReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalLabel", "==", "null", "?", "0", ":", "getLabel", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,383
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ArrayBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "CompilationUnitScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "class", "RecoveredTypeBinding", "implements", "ITypeBinding", "{", "private", "VariableDeclaration", "variableDeclaration", ";", "private", "Type", "currentType", ";", "private", "BindingResolver", "resolver", ";", "private", "int", "dimensions", ";", "private", "RecoveredTypeBinding", "innerTypeBinding", ";", "private", "ITypeBinding", "[", "]", "typeArguments", ";", "private", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "binding", ";", "RecoveredTypeBinding", "(", "BindingResolver", "resolver", ",", "VariableDeclaration", "variableDeclaration", ")", "{", "this", ".", "variableDeclaration", "=", "variableDeclaration", ";", "this", ".", "resolver", "=", "resolver", ";", "this", ".", "currentType", "=", "getType", "(", ")", ";", "this", ".", "dimensions", "=", "variableDeclaration", ".", "getExtraDimensions", "(", ")", ";", "if", "(", "this", ".", "currentType", ".", "isArrayType", "(", ")", ")", "{", "this", ".", "dimensions", "+=", "(", "(", "ArrayType", ")", "this", ".", "currentType", ")", ".", "getDimensions", "(", ")", ";", "}", "}", "RecoveredTypeBinding", "(", "BindingResolver", "resolver", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", "typeBinding", ")", "{", "this", ".", "resolver", "=", "resolver", ";", "this", ".", "dimensions", "=", "typeBinding", ".", "dimensions", "(", ")", ";", "this", ".", "binding", "=", "typeBinding", ";", "}", "RecoveredTypeBinding", "(", "BindingResolver", "resolver", ",", "Type", "type", ")", "{", "this", ".", "currentType", "=", "type", ";", "this", ".", "resolver", "=", "resolver", ";", "this", ".", "dimensions", "=", "0", ";", "if", "(", "type", ".", "isArrayType", "(", ")", ")", "{", "this", ".", "dimensions", "+=", "(", "(", "ArrayType", ")", "type", ")", ".", "getDimensions", "(", ")", ";", "}", "}", "RecoveredTypeBinding", "(", "BindingResolver", "resolver", ",", "RecoveredTypeBinding", "typeBinding", ",", "int", "dimensions", ")", "{", "this", ".", "innerTypeBinding", "=", "typeBinding", ";", "this", ".", "dimensions", "=", "typeBinding", ".", "getDimensions", "(", ")", "+", "dimensions", ";", "this", ".", "resolver", "=", "resolver", ";", "}", "public", "ITypeBinding", "createArrayType", "(", "int", "dims", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "this", ",", "dims", ")", ";", "}", "public", "String", "getBinaryName", "(", ")", "{", "return", "null", ";", "}", "public", "ITypeBinding", "getBound", "(", ")", "{", "return", "null", ";", "}", "public", "ITypeBinding", "getGenericTypeOfWildcardType", "(", ")", "{", "return", "null", ";", "}", "public", "int", "getRank", "(", ")", "{", "return", "-", "1", ";", "}", "public", "ITypeBinding", "getComponentType", "(", ")", "{", "if", "(", "this", ".", "dimensions", "==", "0", ")", "return", "null", ";", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "this", ",", "-", "1", ")", ";", "}", "public", "IVariableBinding", "[", "]", "getDeclaredFields", "(", ")", "{", "return", "TypeBinding", ".", "NO_VARIABLE_BINDINGS", ";", "}", "public", "IMethodBinding", "[", "]", "getDeclaredMethods", "(", ")", "{", "return", "TypeBinding", ".", "NO_METHOD_BINDINGS", ";", "}", "public", "int", "getDeclaredModifiers", "(", ")", "{", "return", "0", ";", "}", "public", "ITypeBinding", "[", "]", "getDeclaredTypes", "(", ")", "{", "return", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "getDeclaringClass", "(", ")", "{", "return", "null", ";", "}", "public", "IMethodBinding", "getDeclaringMethod", "(", ")", "{", "return", "null", ";", "}", "public", "int", "getDimensions", "(", ")", "{", "return", "this", ".", "dimensions", ";", "}", "public", "ITypeBinding", "getElementType", "(", ")", "{", "if", "(", "this", ".", "binding", "!=", "null", ")", "{", "if", "(", "this", ".", "binding", ".", "isArrayType", "(", ")", ")", "{", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "this", ".", "binding", ";", "return", "new", "RecoveredTypeBinding", "(", "this", ".", "resolver", ",", "arrayBinding", ".", "leafComponentType", ")", ";", "}", "else", "{", "return", "new", "RecoveredTypeBinding", "(", "this", ".", "resolver", ",", "this", ".", "binding", ")", ";", "}", "}", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "return", "this", ".", "innerTypeBinding", ".", "getElementType", "(", ")", ";", "}", "if", "(", "this", ".", "currentType", "!=", "null", "&&", "this", ".", "currentType", ".", "isArrayType", "(", ")", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "(", "(", "ArrayType", ")", "this", ".", "currentType", ")", ".", "getElementType", "(", ")", ")", ";", "}", "if", "(", "this", ".", "variableDeclaration", "!=", "null", "&&", "this", ".", "variableDeclaration", ".", "getExtraDimensions", "(", ")", "!=", "0", ")", "{", "return", "this", ".", "resolver", ".", "getTypeBinding", "(", "getType", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "ITypeBinding", "getErasure", "(", ")", "{", "return", "this", ";", "}", "public", "ITypeBinding", "[", "]", "getInterfaces", "(", ")", "{", "return", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "Modifier", ".", "NONE", ";", "}", "public", "String", "getName", "(", ")", "{", "char", "[", "]", "brackets", "=", "new", "char", "[", "this", ".", "dimensions", "*", "2", "]", ";", "for", "(", "int", "i", "=", "this", ".", "dimensions", "*", "2", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "2", ")", "{", "brackets", "[", "i", "]", "=", "']'", ";", "brackets", "[", "i", "-", "1", "]", "=", "'['", ";", "}", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "getInternalName", "(", ")", ")", ";", "buffer", ".", "append", "(", "brackets", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "private", "String", "getInternalName", "(", ")", "{", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "return", "this", ".", "innerTypeBinding", ".", "getInternalName", "(", ")", ";", "}", "ReferenceBinding", "referenceBinding", "=", "getReferenceBinding", "(", ")", ";", "if", "(", "referenceBinding", "!=", "null", ")", "{", "return", "new", "String", "(", "referenceBinding", ".", "compoundName", "[", "referenceBinding", ".", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "return", "getTypeNameFrom", "(", "getType", "(", ")", ")", ";", "}", "public", "IPackageBinding", "getPackage", "(", ")", "{", "if", "(", "this", ".", "binding", "!=", "null", ")", "{", "switch", "(", "this", ".", "binding", ".", "kind", "(", ")", ")", "{", "case", "Binding", ".", "BASE_TYPE", ":", "case", "Binding", ".", "ARRAY_TYPE", ":", "case", "Binding", ".", "TYPE_PARAMETER", ":", "case", "Binding", ".", "WILDCARD_TYPE", ":", "case", "Binding", ".", "INTERSECTION_TYPE", ":", "return", "null", ";", "}", "IPackageBinding", "packageBinding", "=", "this", ".", "resolver", ".", "getPackageBinding", "(", "this", ".", "binding", ".", "getPackage", "(", ")", ")", ";", "if", "(", "packageBinding", "!=", "null", ")", "return", "packageBinding", ";", "}", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", "&&", "this", ".", "dimensions", ">", "0", ")", "{", "return", "null", ";", "}", "CompilationUnitScope", "scope", "=", "this", ".", "resolver", ".", "scope", "(", ")", ";", "if", "(", "scope", "!=", "null", ")", "{", "return", "this", ".", "resolver", ".", "getPackageBinding", "(", "scope", ".", "getCurrentPackage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "String", "getQualifiedName", "(", ")", "{", "ReferenceBinding", "referenceBinding", "=", "getReferenceBinding", "(", ")", ";", "if", "(", "referenceBinding", "!=", "null", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "char", "[", "]", "brackets", "=", "new", "char", "[", "this", ".", "dimensions", "*", "2", "]", ";", "for", "(", "int", "i", "=", "this", ".", "dimensions", "*", "2", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "2", ")", "{", "brackets", "[", "i", "]", "=", "']'", ";", "brackets", "[", "i", "-", "1", "]", "=", "'['", ";", "}", "buffer", ".", "append", "(", "CharOperation", ".", "toString", "(", "referenceBinding", ".", "compoundName", ")", ")", ";", "buffer", ".", "append", "(", "brackets", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "else", "{", "return", "getName", "(", ")", ";", "}", "}", "private", "ReferenceBinding", "getReferenceBinding", "(", ")", "{", "if", "(", "this", ".", "binding", "!=", "null", ")", "{", "if", "(", "this", ".", "binding", ".", "isArrayType", "(", ")", ")", "{", "ArrayBinding", "arrayBinding", "=", "(", "ArrayBinding", ")", "this", ".", "binding", ";", "if", "(", "arrayBinding", ".", "leafComponentType", "instanceof", "ReferenceBinding", ")", "{", "return", "(", "ReferenceBinding", ")", "arrayBinding", ".", "leafComponentType", ";", "}", "}", "else", "if", "(", "this", ".", "binding", "instanceof", "ReferenceBinding", ")", "{", "return", "(", "ReferenceBinding", ")", "this", ".", "binding", ";", "}", "}", "else", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "return", "this", ".", "innerTypeBinding", ".", "getReferenceBinding", "(", ")", ";", "}", "return", "null", ";", "}", "public", "ITypeBinding", "getSuperclass", "(", ")", "{", "if", "(", "getQualifiedName", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "null", ";", "}", "return", "this", ".", "resolver", ".", "resolveWellKnownType", "(", "\"\"", ")", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeArguments", "(", ")", "{", "if", "(", "this", ".", "binding", "!=", "null", ")", "{", "return", "this", ".", "typeArguments", "=", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "if", "(", "this", ".", "typeArguments", "!=", "null", ")", "{", "return", "this", ".", "typeArguments", ";", "}", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "return", "this", ".", "innerTypeBinding", ".", "getTypeArguments", "(", ")", ";", "}", "if", "(", "this", ".", "currentType", ".", "isParameterizedType", "(", ")", ")", "{", "ParameterizedType", "parameterizedType", "=", "(", "ParameterizedType", ")", "this", ".", "currentType", ";", "List", "typeArgumentsList", "=", "parameterizedType", ".", "typeArguments", "(", ")", ";", "int", "size", "=", "typeArgumentsList", ".", "size", "(", ")", ";", "ITypeBinding", "[", "]", "temp", "=", "new", "ITypeBinding", "[", "size", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "ITypeBinding", "currentTypeBinding", "=", "(", "(", "Type", ")", "typeArgumentsList", ".", "get", "(", "i", ")", ")", ".", "resolveBinding", "(", ")", ";", "if", "(", "currentTypeBinding", "==", "null", ")", "{", "return", "this", ".", "typeArguments", "=", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "temp", "[", "i", "]", "=", "currentTypeBinding", ";", "}", "return", "this", ".", "typeArguments", "=", "temp", ";", "}", "return", "this", ".", "typeArguments", "=", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeBounds", "(", ")", "{", "return", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "getTypeDeclaration", "(", ")", "{", "return", "this", ";", "}", "public", "ITypeBinding", "[", "]", "getTypeParameters", "(", ")", "{", "return", "TypeBinding", ".", "NO_TYPE_BINDINGS", ";", "}", "public", "ITypeBinding", "getWildcard", "(", ")", "{", "return", "null", ";", "}", "public", "boolean", "isAnnotation", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isAnonymous", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isArray", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isAssignmentCompatible", "(", "ITypeBinding", "typeBinding", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "typeBinding", ".", "getQualifiedName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "return", "isEqualTo", "(", "typeBinding", ")", ";", "}", "public", "boolean", "isCapture", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isCastCompatible", "(", "ITypeBinding", "typeBinding", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "typeBinding", ".", "getQualifiedName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "return", "isEqualTo", "(", "typeBinding", ")", ";", "}", "public", "boolean", "isClass", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isEnum", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isFromSource", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isGenericType", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isInterface", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isLocal", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isMember", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isNested", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isNullType", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isParameterizedType", "(", ")", "{", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "return", "this", ".", "innerTypeBinding", ".", "isParameterizedType", "(", ")", ";", "}", "if", "(", "this", ".", "currentType", "!=", "null", ")", "{", "return", "this", ".", "currentType", ".", "isParameterizedType", "(", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "isPrimitive", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isRawType", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isSubTypeCompatible", "(", "ITypeBinding", "typeBinding", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "typeBinding", ".", "getQualifiedName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "return", "isEqualTo", "(", "typeBinding", ")", ";", "}", "public", "boolean", "isTopLevel", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isTypeVariable", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isUpperbound", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isWildcardType", "(", ")", "{", "return", "false", ";", "}", "public", "IAnnotationBinding", "[", "]", "getAnnotations", "(", ")", "{", "return", "AnnotationBinding", ".", "NoAnnotations", ";", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "IPackageBinding", "packageBinding", "=", "getPackage", "(", ")", ";", "if", "(", "packageBinding", "!=", "null", ")", "{", "final", "IJavaElement", "javaElement", "=", "packageBinding", ".", "getJavaElement", "(", ")", ";", "if", "(", "javaElement", "!=", "null", "&&", "javaElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "return", "(", "(", "PackageFragment", ")", "javaElement", ")", ".", "getCompilationUnit", "(", "getInternalName", "(", ")", "+", "SuffixConstants", ".", "SUFFIX_STRING_java", ")", ".", "getType", "(", "this", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "null", ";", "}", "public", "String", "getKey", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"Recovered#\"", ")", ";", "if", "(", "this", ".", "innerTypeBinding", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ".", "append", "(", "this", ".", "innerTypeBinding", ".", "getKey", "(", ")", ")", ";", "}", "else", "if", "(", "this", ".", "currentType", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"currentType\"", ")", ".", "append", "(", "this", ".", "currentType", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "this", ".", "binding", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"typeBinding\"", ")", ".", "append", "(", "this", ".", "binding", ".", "computeUniqueKey", "(", ")", ")", ";", "}", "else", "if", "(", "this", ".", "variableDeclaration", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ".", "append", "(", "this", ".", "variableDeclaration", ".", "getClass", "(", ")", ")", ".", "append", "(", "this", ".", "variableDeclaration", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ")", ".", "append", "(", "this", ".", "variableDeclaration", ".", "getExtraDimensions", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "getDimensions", "(", ")", ")", ";", "if", "(", "this", ".", "typeArguments", "!=", "null", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "typeArguments", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "this", ".", "typeArguments", "[", "i", "]", ".", "getKey", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "IBinding", ".", "TYPE", ";", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isEqualTo", "(", "IBinding", "other", ")", "{", "if", "(", "!", "other", ".", "isRecovered", "(", ")", "||", "other", ".", "getKind", "(", ")", "!=", "IBinding", ".", "TYPE", ")", "return", "false", ";", "return", "getKey", "(", ")", ".", "equals", "(", "other", ".", "getKey", "(", ")", ")", ";", "}", "public", "boolean", "isRecovered", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isSynthetic", "(", ")", "{", "return", "false", ";", "}", "private", "String", "getTypeNameFrom", "(", "Type", "type", ")", "{", "if", "(", "type", "==", "null", ")", "return", "Util", ".", "EMPTY_STRING", ";", "switch", "(", "type", ".", "getNodeType0", "(", ")", ")", "{", "case", "ASTNode", ".", "ARRAY_TYPE", ":", "ArrayType", "arrayType", "=", "(", "ArrayType", ")", "type", ";", "type", "=", "arrayType", ".", "getElementType", "(", ")", ";", "return", "getTypeNameFrom", "(", "type", ")", ";", "case", "ASTNode", ".", "PARAMETERIZED_TYPE", ":", "ParameterizedType", "parameterizedType", "=", "(", "ParameterizedType", ")", "type", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "getTypeNameFrom", "(", "parameterizedType", ".", "getType", "(", ")", ")", ")", ";", "ITypeBinding", "[", "]", "tArguments", "=", "getTypeArguments", "(", ")", ";", "final", "int", "typeArgumentsLength", "=", "tArguments", ".", "length", ";", "if", "(", "typeArgumentsLength", "!=", "0", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArgumentsLength", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "tArguments", "[", "i", "]", ".", "getName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "case", "ASTNode", ".", "PRIMITIVE_TYPE", ":", "PrimitiveType", "primitiveType", "=", "(", "PrimitiveType", ")", "type", ";", "return", "primitiveType", ".", "getPrimitiveTypeCode", "(", ")", ".", "toString", "(", ")", ";", "case", "ASTNode", ".", "QUALIFIED_TYPE", ":", "QualifiedType", "qualifiedType", "=", "(", "QualifiedType", ")", "type", ";", "return", "qualifiedType", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ";", "case", "ASTNode", ".", "SIMPLE_TYPE", ":", "SimpleType", "simpleType", "=", "(", "SimpleType", ")", "type", ";", "Name", "name", "=", "simpleType", ".", "getName", "(", ")", ";", "if", "(", "name", ".", "isQualifiedName", "(", ")", ")", "{", "QualifiedName", "qualifiedName", "=", "(", "QualifiedName", ")", "name", ";", "return", "qualifiedName", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ";", "}", "return", "(", "(", "SimpleName", ")", "name", ")", ".", "getIdentifier", "(", ")", ";", "}", "return", "Util", ".", "EMPTY_STRING", ";", "}", "private", "Type", "getType", "(", ")", "{", "if", "(", "this", ".", "currentType", "!=", "null", ")", "{", "return", "this", ".", "currentType", ";", "}", "if", "(", "this", ".", "variableDeclaration", "==", "null", ")", "return", "null", ";", "switch", "(", "this", ".", "variableDeclaration", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "SINGLE_VARIABLE_DECLARATION", ":", "SingleVariableDeclaration", "singleVariableDeclaration", "=", "(", "SingleVariableDeclaration", ")", "this", ".", "variableDeclaration", ";", "return", "singleVariableDeclaration", ".", "getType", "(", ")", ";", "default", ":", "ASTNode", "parent", "=", "this", ".", "variableDeclaration", ".", "getParent", "(", ")", ";", "switch", "(", "parent", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "VARIABLE_DECLARATION_EXPRESSION", ":", "VariableDeclarationExpression", "variableDeclarationExpression", "=", "(", "VariableDeclarationExpression", ")", "parent", ";", "return", "variableDeclarationExpression", ".", "getType", "(", ")", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_STATEMENT", ":", "VariableDeclarationStatement", "statement", "=", "(", "VariableDeclarationStatement", ")", "parent", ";", "return", "statement", ".", "getType", "(", ")", ";", "case", "ASTNode", ".", "FIELD_DECLARATION", ":", "FieldDeclaration", "fieldDeclaration", "=", "(", "FieldDeclaration", ")", "parent", ";", "return", "fieldDeclaration", ".", "getType", "(", ")", ";", "}", "}", "return", "null", ";", "}", "}", "</s>" ]
2,384
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "LabeledStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "LABEL_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "LabeledStatement", ".", "class", ",", "\"label\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "BODY_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "LabeledStatement", ".", "class", ",", "\"body\"", ",", "Statement", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "LabeledStatement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "LABEL_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "labelName", "=", "null", ";", "private", "Statement", "body", "=", "null", ";", "LabeledStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "LABEL_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getLabel", "(", ")", ";", "}", "else", "{", "setLabel", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "BODY_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getBody", "(", ")", ";", "}", "else", "{", "setBody", "(", "(", "Statement", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "LABELED_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "LabeledStatement", "result", "=", "new", "LabeledStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setLabel", "(", "(", "SimpleName", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getLabel", "(", ")", ")", ")", ";", "result", ".", "setBody", "(", "(", "Statement", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getBody", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getLabel", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getBody", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getLabel", "(", ")", "{", "if", "(", "this", ".", "labelName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "labelName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "labelName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "labelName", ",", "LABEL_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "labelName", ";", "}", "public", "void", "setLabel", "(", "SimpleName", "label", ")", "{", "if", "(", "label", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "labelName", ";", "preReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "this", ".", "labelName", "=", "label", ";", "postReplaceChild", "(", "oldChild", ",", "label", ",", "LABEL_PROPERTY", ")", ";", "}", "public", "Statement", "getBody", "(", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "body", "=", "new", "EmptyStatement", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "body", ",", "BODY_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "body", ";", "}", "public", "void", "setBody", "(", "Statement", "statement", ")", "{", "if", "(", "statement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "body", ";", "preReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "this", ".", "body", "=", "statement", ";", "postReplaceChild", "(", "oldChild", ",", "statement", ",", "BODY_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "labelName", "==", "null", "?", "0", ":", "getLabel", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "body", "==", "null", "?", "0", ":", "getBody", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,385
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "FieldAccess", "extends", "Expression", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "FieldAccess", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "FieldAccess", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "FieldAccess", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "expression", "=", "null", ";", "private", "SimpleName", "fieldName", "=", "null", ";", "FieldAccess", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "FIELD_ACCESS", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "FieldAccess", "result", "=", "new", "FieldAccess", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "getExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "expression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "expression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "expression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "expression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "fieldName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "fieldName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "fieldName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "fieldName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "fieldName", ";", "}", "public", "void", "setName", "(", "SimpleName", "fieldName", ")", "{", "if", "(", "fieldName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "fieldName", ";", "preReplaceChild", "(", "oldChild", ",", "fieldName", ",", "NAME_PROPERTY", ")", ";", "this", ".", "fieldName", "=", "fieldName", ";", "postReplaceChild", "(", "oldChild", ",", "fieldName", ",", "NAME_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "public", "IVariableBinding", "resolveFieldBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveField", "(", "this", ")", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "expression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "fieldName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,386
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "class", "NodeEventHandler", "{", "NodeEventHandler", "(", ")", "{", "}", "void", "preRemoveChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "postRemoveChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "preReplaceChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "ASTNode", "newChild", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "postReplaceChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "ASTNode", "newChild", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "preAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "postAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "}", "void", "preValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "}", "void", "postValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "}", "void", "preCloneNodeEvent", "(", "ASTNode", "node", ")", "{", "}", "void", "postCloneNodeEvent", "(", "ASTNode", "node", ",", "ASTNode", "clone", ")", "{", "}", "}", "</s>" ]
2,387
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "VariableDeclarationFragment", "extends", "VariableDeclaration", "{", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "VariableDeclarationFragment", ".", "class", ",", "\"name\"", ",", "SimpleName", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "public", "static", "final", "SimplePropertyDescriptor", "EXTRA_DIMENSIONS_PROPERTY", "=", "new", "SimplePropertyDescriptor", "(", "VariableDeclarationFragment", ".", "class", ",", "\"\"", ",", "int", ".", "class", ",", "MANDATORY", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "INITIALIZER_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "VariableDeclarationFragment", ".", "class", ",", "\"initializer\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "VariableDeclarationFragment", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "EXTRA_DIMENSIONS_PROPERTY", ",", "propertyList", ")", ";", "addProperty", "(", "INITIALIZER_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "SimpleName", "variableName", "=", "null", ";", "private", "int", "extraArrayDimensions", "=", "0", ";", "private", "Expression", "optionalInitializer", "=", "null", ";", "VariableDeclarationFragment", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "SimplePropertyDescriptor", "internalExtraDimensionsProperty", "(", ")", "{", "return", "EXTRA_DIMENSIONS_PROPERTY", ";", "}", "final", "ChildPropertyDescriptor", "internalInitializerProperty", "(", ")", "{", "return", "INITIALIZER_PROPERTY", ";", "}", "final", "ChildPropertyDescriptor", "internalNameProperty", "(", ")", "{", "return", "NAME_PROPERTY", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "int", "internalGetSetIntProperty", "(", "SimplePropertyDescriptor", "property", ",", "boolean", "get", ",", "int", "value", ")", "{", "if", "(", "property", "==", "EXTRA_DIMENSIONS_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExtraDimensions", "(", ")", ";", "}", "else", "{", "setExtraDimensions", "(", "value", ")", ";", "return", "0", ";", "}", "}", "return", "super", ".", "internalGetSetIntProperty", "(", "property", ",", "get", ",", "value", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "SimpleName", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "INITIALIZER_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getInitializer", "(", ")", ";", "}", "else", "{", "setInitializer", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "VARIABLE_DECLARATION_FRAGMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "VariableDeclarationFragment", "result", "=", "new", "VariableDeclarationFragment", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "SimpleName", ")", "getName", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setExtraDimensions", "(", "getExtraDimensions", "(", ")", ")", ";", "result", ".", "setInitializer", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getInitializer", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getInitializer", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SimpleName", "getName", "(", ")", "{", "if", "(", "this", ".", "variableName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "variableName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "variableName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "variableName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "variableName", ";", "}", "public", "void", "setName", "(", "SimpleName", "variableName", ")", "{", "if", "(", "variableName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "variableName", ";", "preReplaceChild", "(", "oldChild", ",", "variableName", ",", "NAME_PROPERTY", ")", ";", "this", ".", "variableName", "=", "variableName", ";", "postReplaceChild", "(", "oldChild", ",", "variableName", ",", "NAME_PROPERTY", ")", ";", "}", "public", "int", "getExtraDimensions", "(", ")", "{", "return", "this", ".", "extraArrayDimensions", ";", "}", "public", "void", "setExtraDimensions", "(", "int", "dimensions", ")", "{", "if", "(", "dimensions", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "preValueChange", "(", "EXTRA_DIMENSIONS_PROPERTY", ")", ";", "this", ".", "extraArrayDimensions", "=", "dimensions", ";", "postValueChange", "(", "EXTRA_DIMENSIONS_PROPERTY", ")", ";", "}", "public", "Expression", "getInitializer", "(", ")", "{", "return", "this", ".", "optionalInitializer", ";", "}", "public", "void", "setInitializer", "(", "Expression", "initializer", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalInitializer", ";", "preReplaceChild", "(", "oldChild", ",", "initializer", ",", "INITIALIZER_PROPERTY", ")", ";", "this", ".", "optionalInitializer", "=", "initializer", ";", "postReplaceChild", "(", "oldChild", ",", "initializer", ",", "INITIALIZER_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "variableName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalInitializer", "==", "null", "?", "0", ":", "getInitializer", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,388
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "CatchClause", "extends", "ASTNode", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXCEPTION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "CatchClause", ".", "class", ",", "\"exception\"", ",", "SingleVariableDeclaration", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "BODY_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "CatchClause", ".", "class", ",", "\"body\"", ",", "Block", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "3", ")", ";", "createPropertyList", "(", "CatchClause", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXCEPTION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "BODY_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Block", "body", "=", "null", ";", "private", "SingleVariableDeclaration", "exceptionDecl", "=", "null", ";", "CatchClause", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXCEPTION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getException", "(", ")", ";", "}", "else", "{", "setException", "(", "(", "SingleVariableDeclaration", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "BODY_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getBody", "(", ")", ";", "}", "else", "{", "setBody", "(", "(", "Block", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "CATCH_CLAUSE", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "CatchClause", "result", "=", "new", "CatchClause", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setBody", "(", "(", "Block", ")", "getBody", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setException", "(", "(", "SingleVariableDeclaration", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getException", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getException", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getBody", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "SingleVariableDeclaration", "getException", "(", ")", "{", "if", "(", "this", ".", "exceptionDecl", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "exceptionDecl", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "exceptionDecl", "=", "new", "SingleVariableDeclaration", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "exceptionDecl", ",", "EXCEPTION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "exceptionDecl", ";", "}", "public", "void", "setException", "(", "SingleVariableDeclaration", "exception", ")", "{", "if", "(", "exception", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "exceptionDecl", ";", "preReplaceChild", "(", "oldChild", ",", "exception", ",", "EXCEPTION_PROPERTY", ")", ";", "this", ".", "exceptionDecl", "=", "exception", ";", "postReplaceChild", "(", "oldChild", ",", "exception", ",", "EXCEPTION_PROPERTY", ")", ";", "}", "public", "Block", "getBody", "(", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "body", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "body", "=", "new", "Block", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "body", ",", "BODY_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "body", ";", "}", "public", "void", "setBody", "(", "Block", "body", ")", "{", "if", "(", "body", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "body", ";", "preReplaceChild", "(", "oldChild", ",", "body", ",", "BODY_PROPERTY", ")", ";", "this", ".", "body", "=", "body", ";", "postReplaceChild", "(", "oldChild", ",", "body", ",", "BODY_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "2", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "exceptionDecl", "==", "null", "?", "0", ":", "getException", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "body", "==", "null", "?", "0", ":", "getBody", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,389
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MultiTextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "TextUtilities", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimplePropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "StructuralPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "TargetSourceRangeComputer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "RecoveryScannerData", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewriteAnalyzer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "LineInformation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "ListRewriteEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeInfoStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "NodeRewriteEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "CopySourceInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "dom", ".", "rewrite", ".", "RewriteEventStore", ".", "PropertyLocation", ";", "class", "InternalASTRewrite", "extends", "NodeEventHandler", "{", "private", "CompilationUnit", "root", ";", "protected", "final", "RewriteEventStore", "eventStore", ";", "protected", "final", "NodeInfoStore", "nodeStore", ";", "protected", "final", "Hashtable", "clonedNodes", ";", "int", "cloneDepth", "=", "0", ";", "public", "InternalASTRewrite", "(", "CompilationUnit", "root", ")", "{", "this", ".", "root", "=", "root", ";", "this", ".", "eventStore", "=", "new", "RewriteEventStore", "(", ")", ";", "this", ".", "nodeStore", "=", "new", "NodeInfoStore", "(", "root", ".", "getAST", "(", ")", ")", ";", "this", ".", "clonedNodes", "=", "new", "Hashtable", "(", ")", ";", "}", "public", "TextEdit", "rewriteAST", "(", "IDocument", "document", ",", "Map", "options", ")", "{", "TextEdit", "result", "=", "new", "MultiTextEdit", "(", ")", ";", "final", "CompilationUnit", "rootNode", "=", "getRootNode", "(", ")", ";", "if", "(", "rootNode", "!=", "null", ")", "{", "TargetSourceRangeComputer", "xsrComputer", "=", "new", "TargetSourceRangeComputer", "(", ")", "{", "public", "SourceRange", "computeSourceRange", "(", "ASTNode", "node", ")", "{", "int", "extendedStartPosition", "=", "rootNode", ".", "getExtendedStartPosition", "(", "node", ")", ";", "int", "extendedLength", "=", "rootNode", ".", "getExtendedLength", "(", "node", ")", ";", "return", "new", "SourceRange", "(", "extendedStartPosition", ",", "extendedLength", ")", ";", "}", "}", ";", "char", "[", "]", "content", "=", "document", ".", "get", "(", ")", ".", "toCharArray", "(", ")", ";", "LineInformation", "lineInfo", "=", "LineInformation", ".", "create", "(", "document", ")", ";", "String", "lineDelim", "=", "TextUtilities", ".", "getDefaultLineDelimiter", "(", "document", ")", ";", "List", "comments", "=", "rootNode", ".", "getCommentList", "(", ")", ";", "Map", "currentOptions", "=", "options", "==", "null", "?", "JavaCore", ".", "getOptions", "(", ")", ":", "options", ";", "ASTRewriteAnalyzer", "visitor", "=", "new", "ASTRewriteAnalyzer", "(", "content", ",", "lineInfo", ",", "lineDelim", ",", "result", ",", "this", ".", "eventStore", ",", "this", ".", "nodeStore", ",", "comments", ",", "currentOptions", ",", "xsrComputer", ",", "(", "RecoveryScannerData", ")", "rootNode", ".", "getStatementsRecoveryData", "(", ")", ")", ";", "rootNode", ".", "accept", "(", "visitor", ")", ";", "}", "return", "result", ";", "}", "private", "void", "markAsMoveOrCopyTarget", "(", "ASTNode", "node", ",", "ASTNode", "newChild", ")", "{", "ASTNode", "source", "=", "(", "ASTNode", ")", "this", ".", "clonedNodes", ".", "get", "(", "newChild", ")", ";", "if", "(", "source", "!=", "null", ")", "{", "if", "(", "this", ".", "cloneDepth", "==", "0", ")", "{", "PropertyLocation", "propertyLocation", "=", "this", ".", "eventStore", ".", "getPropertyLocation", "(", "source", ",", "RewriteEventStore", ".", "ORIGINAL", ")", ";", "CopySourceInfo", "sourceInfo", "=", "this", ".", "eventStore", ".", "markAsCopySource", "(", "propertyLocation", ".", "getParent", "(", ")", ",", "propertyLocation", ".", "getProperty", "(", ")", ",", "source", ",", "false", ")", ";", "this", ".", "nodeStore", ".", "markAsCopyTarget", "(", "newChild", ",", "sourceInfo", ")", ";", "}", "}", "else", "if", "(", "(", "newChild", ".", "getFlags", "(", ")", "&", "ASTNode", ".", "ORIGINAL", ")", "!=", "0", ")", "{", "PropertyLocation", "propertyLocation", "=", "this", ".", "eventStore", ".", "getPropertyLocation", "(", "newChild", ",", "RewriteEventStore", ".", "ORIGINAL", ")", ";", "CopySourceInfo", "sourceInfo", "=", "this", ".", "eventStore", ".", "markAsCopySource", "(", "propertyLocation", ".", "getParent", "(", ")", ",", "propertyLocation", ".", "getProperty", "(", ")", ",", "newChild", ",", "true", ")", ";", "this", ".", "nodeStore", ".", "markAsCopyTarget", "(", "newChild", ",", "sourceInfo", ")", ";", "}", "}", "private", "CompilationUnit", "getRootNode", "(", ")", "{", "return", "this", ".", "root", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "\"Events:n\"", ")", ";", "buf", ".", "append", "(", "this", ".", "eventStore", ".", "toString", "(", ")", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}", "void", "preValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "getNodeEvent", "(", "node", ",", "property", ")", ";", "}", "void", "postValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "NodeRewriteEvent", "event", "=", "getNodeEvent", "(", "node", ",", "property", ")", ";", "event", ".", "setNewValue", "(", "node", ".", "getStructuralProperty", "(", "property", ")", ")", ";", "}", "void", "preAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "property", ".", "isChildProperty", "(", ")", ")", "{", "NodeRewriteEvent", "event", "=", "getNodeEvent", "(", "node", ",", "property", ")", ";", "event", ".", "setNewValue", "(", "child", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "markAsMoveOrCopyTarget", "(", "node", ",", "child", ")", ";", "}", "}", "else", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "getListEvent", "(", "node", ",", "property", ")", ";", "}", "}", "void", "postAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "ListRewriteEvent", "event", "=", "getListEvent", "(", "node", ",", "property", ")", ";", "List", "list", "=", "(", "List", ")", "node", ".", "getStructuralProperty", "(", "property", ")", ";", "int", "i", "=", "list", ".", "indexOf", "(", "child", ")", ";", "int", "s", "=", "list", ".", "size", "(", ")", ";", "int", "index", ";", "if", "(", "i", "+", "1", "<", "s", ")", "{", "ASTNode", "nextNode", "=", "(", "ASTNode", ")", "list", ".", "get", "(", "i", "+", "1", ")", ";", "index", "=", "event", ".", "getIndex", "(", "nextNode", ",", "ListRewriteEvent", ".", "NEW", ")", ";", "}", "else", "{", "index", "=", "-", "1", ";", "}", "event", ".", "insert", "(", "child", ",", "index", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "markAsMoveOrCopyTarget", "(", "node", ",", "child", ")", ";", "}", "}", "}", "void", "preRemoveChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "property", ".", "isChildProperty", "(", ")", ")", "{", "NodeRewriteEvent", "event", "=", "getNodeEvent", "(", "node", ",", "property", ")", ";", "event", ".", "setNewValue", "(", "null", ")", ";", "}", "else", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "ListRewriteEvent", "event", "=", "getListEvent", "(", "node", ",", "property", ")", ";", "int", "i", "=", "event", ".", "getIndex", "(", "child", ",", "ListRewriteEvent", ".", "NEW", ")", ";", "NodeRewriteEvent", "nodeEvent", "=", "(", "NodeRewriteEvent", ")", "event", ".", "getChildren", "(", ")", "[", "i", "]", ";", "if", "(", "nodeEvent", ".", "getOriginalValue", "(", ")", "==", "null", ")", "{", "event", ".", "revertChange", "(", "nodeEvent", ")", ";", "}", "else", "{", "nodeEvent", ".", "setNewValue", "(", "null", ")", ";", "}", "}", "}", "void", "preReplaceChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "ASTNode", "newChild", ",", "StructuralPropertyDescriptor", "property", ")", "{", "if", "(", "property", ".", "isChildProperty", "(", ")", ")", "{", "NodeRewriteEvent", "event", "=", "getNodeEvent", "(", "node", ",", "property", ")", ";", "event", ".", "setNewValue", "(", "newChild", ")", ";", "if", "(", "newChild", "!=", "null", ")", "{", "markAsMoveOrCopyTarget", "(", "node", ",", "newChild", ")", ";", "}", "}", "else", "if", "(", "property", ".", "isChildListProperty", "(", ")", ")", "{", "ListRewriteEvent", "event", "=", "getListEvent", "(", "node", ",", "property", ")", ";", "int", "i", "=", "event", ".", "getIndex", "(", "child", ",", "ListRewriteEvent", ".", "NEW", ")", ";", "NodeRewriteEvent", "nodeEvent", "=", "(", "NodeRewriteEvent", ")", "event", ".", "getChildren", "(", ")", "[", "i", "]", ";", "nodeEvent", ".", "setNewValue", "(", "newChild", ")", ";", "if", "(", "newChild", "!=", "null", ")", "{", "markAsMoveOrCopyTarget", "(", "node", ",", "newChild", ")", ";", "}", "}", "}", "void", "preCloneNodeEvent", "(", "ASTNode", "node", ")", "{", "this", ".", "cloneDepth", "++", ";", "}", "void", "postCloneNodeEvent", "(", "ASTNode", "node", ",", "ASTNode", "clone", ")", "{", "if", "(", "node", ".", "ast", "==", "this", ".", "root", ".", "ast", "&&", "clone", ".", "ast", "==", "this", ".", "root", ".", "ast", ")", "{", "if", "(", "(", "node", ".", "getFlags", "(", ")", "&", "ASTNode", ".", "ORIGINAL", ")", "!=", "0", ")", "{", "this", ".", "clonedNodes", ".", "put", "(", "clone", ",", "node", ")", ";", "}", "else", "{", "Object", "original", "=", "this", ".", "clonedNodes", ".", "get", "(", "node", ")", ";", "if", "(", "original", "!=", "null", ")", "{", "this", ".", "clonedNodes", ".", "put", "(", "clone", ",", "original", ")", ";", "}", "}", "}", "this", ".", "cloneDepth", "--", ";", "}", "private", "NodeRewriteEvent", "getNodeEvent", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "return", "this", ".", "eventStore", ".", "getNodeEvent", "(", "node", ",", "property", ",", "true", ")", ";", "}", "private", "ListRewriteEvent", "getListEvent", "(", "ASTNode", "node", ",", "StructuralPropertyDescriptor", "property", ")", "{", "return", "this", ".", "eventStore", ".", "getListEvent", "(", "node", ",", "property", ",", "true", ")", ";", "}", "}", "</s>" ]
2,390
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "interface", "IMemberValuePairBinding", "extends", "IBinding", "{", "public", "String", "getName", "(", ")", ";", "public", "IMethodBinding", "getMethodBinding", "(", ")", ";", "public", "Object", "getValue", "(", ")", ";", "public", "boolean", "isDefault", "(", ")", ";", "}", "</s>" ]
2,391
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "SimpleType", "extends", "Type", "{", "public", "static", "final", "ChildPropertyDescriptor", "NAME_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "SimpleType", ".", "class", ",", "\"name\"", ",", "Name", ".", "class", ",", "MANDATORY", ",", "NO_CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "SimpleType", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "NAME_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Name", "typeName", "=", "null", ";", "SimpleType", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "NAME_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getName", "(", ")", ";", "}", "else", "{", "setName", "(", "(", "Name", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "SIMPLE_TYPE", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "SimpleType", "result", "=", "new", "SimpleType", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "setName", "(", "(", "Name", ")", "(", "getName", "(", ")", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getName", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Name", "getName", "(", ")", "{", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "typeName", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "typeName", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "typeName", ",", "NAME_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "typeName", ";", "}", "public", "void", "setName", "(", "Name", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "typeName", ";", "preReplaceChild", "(", "oldChild", ",", "typeName", ",", "NAME_PROPERTY", ")", ";", "this", ".", "typeName", "=", "typeName", ";", "postReplaceChild", "(", "oldChild", ",", "typeName", ",", "NAME_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeName", "==", "null", "?", "0", ":", "getName", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,392
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "TypeDeclarationStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "TYPE_DECLARATION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "TypeDeclarationStatement", ".", "class", ",", "\"\"", ",", "TypeDeclaration", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "DECLARATION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "TypeDeclarationStatement", ".", "class", ",", "\"declaration\"", ",", "AbstractTypeDeclaration", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_2_0", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS_3_0", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "TypeDeclarationStatement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "TYPE_DECLARATION_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_2_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "TypeDeclarationStatement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "DECLARATION_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS_3_0", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "if", "(", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "PROPERTY_DESCRIPTORS_2_0", ";", "}", "else", "{", "return", "PROPERTY_DESCRIPTORS_3_0", ";", "}", "}", "private", "AbstractTypeDeclaration", "typeDecl", "=", "null", ";", "private", "ChildPropertyDescriptor", "typeDeclProperty", "(", ")", "{", "if", "(", "getAST", "(", ")", ".", "apiLevel", "(", ")", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "TYPE_DECLARATION_PROPERTY", ";", "}", "else", "{", "return", "DECLARATION_PROPERTY", ";", "}", "}", "TypeDeclarationStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "TYPE_DECLARATION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getTypeDeclaration", "(", ")", ";", "}", "else", "{", "setTypeDeclaration", "(", "(", "TypeDeclaration", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "DECLARATION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getDeclaration", "(", ")", ";", "}", "else", "{", "setDeclaration", "(", "(", "AbstractTypeDeclaration", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "TYPE_DECLARATION_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "TypeDeclarationStatement", "result", "=", "new", "TypeDeclarationStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setDeclaration", "(", "(", "AbstractTypeDeclaration", ")", "getDeclaration", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getDeclaration", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "AbstractTypeDeclaration", "getDeclaration", "(", ")", "{", "if", "(", "this", ".", "typeDecl", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "typeDecl", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "typeDecl", "=", "new", "TypeDeclaration", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "typeDecl", ",", "typeDeclProperty", "(", ")", ")", ";", "}", "}", "}", "return", "this", ".", "typeDecl", ";", "}", "public", "void", "setDeclaration", "(", "AbstractTypeDeclaration", "decl", ")", "{", "if", "(", "decl", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "typeDecl", ";", "ChildPropertyDescriptor", "typeDeclProperty", "=", "typeDeclProperty", "(", ")", ";", "preReplaceChild", "(", "oldChild", ",", "decl", ",", "typeDeclProperty", ")", ";", "this", ".", "typeDecl", "=", "decl", ";", "postReplaceChild", "(", "oldChild", ",", "decl", ",", "typeDeclProperty", ")", ";", "}", "public", "TypeDeclaration", "getTypeDeclaration", "(", ")", "{", "return", "internalGetTypeDeclaration", "(", ")", ";", "}", "final", "TypeDeclaration", "internalGetTypeDeclaration", "(", ")", "{", "supportedOnlyIn2", "(", ")", ";", "return", "(", "TypeDeclaration", ")", "getDeclaration", "(", ")", ";", "}", "public", "void", "setTypeDeclaration", "(", "TypeDeclaration", "decl", ")", "{", "internalSetTypeDeclaration", "(", "decl", ")", ";", "}", "final", "void", "internalSetTypeDeclaration", "(", "TypeDeclaration", "decl", ")", "{", "supportedOnlyIn2", "(", ")", ";", "setDeclaration", "(", "decl", ")", ";", "}", "public", "ITypeBinding", "resolveBinding", "(", ")", "{", "AbstractTypeDeclaration", "d", "=", "getDeclaration", "(", ")", ";", "if", "(", "d", "instanceof", "TypeDeclaration", ")", "{", "return", "(", "(", "TypeDeclaration", ")", "d", ")", ".", "resolveBinding", "(", ")", ";", "}", "else", "if", "(", "d", "instanceof", "AnnotationTypeDeclaration", ")", "{", "return", "(", "(", "AnnotationTypeDeclaration", ")", "d", ")", ".", "resolveBinding", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "typeDecl", "==", "null", "?", "0", ":", "getDeclaration", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,393
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ASTMatcher", "{", "private", "boolean", "matchDocTags", ";", "public", "ASTMatcher", "(", ")", "{", "this", "(", "false", ")", ";", "}", "public", "ASTMatcher", "(", "boolean", "matchDocTags", ")", "{", "this", ".", "matchDocTags", "=", "matchDocTags", ";", "}", "public", "final", "boolean", "safeSubtreeListMatch", "(", "List", "list1", ",", "List", "list2", ")", "{", "int", "size1", "=", "list1", ".", "size", "(", ")", ";", "int", "size2", "=", "list2", ".", "size", "(", ")", ";", "if", "(", "size1", "!=", "size2", ")", "{", "return", "false", ";", "}", "for", "(", "Iterator", "it1", "=", "list1", ".", "iterator", "(", ")", ",", "it2", "=", "list2", ".", "iterator", "(", ")", ";", "it1", ".", "hasNext", "(", ")", ";", ")", "{", "ASTNode", "n1", "=", "(", "ASTNode", ")", "it1", ".", "next", "(", ")", ";", "ASTNode", "n2", "=", "(", "ASTNode", ")", "it2", ".", "next", "(", ")", ";", "if", "(", "!", "n1", ".", "subtreeMatch", "(", "this", ",", "n2", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "public", "final", "boolean", "safeSubtreeMatch", "(", "Object", "node1", ",", "Object", "node2", ")", "{", "if", "(", "node1", "==", "null", "&&", "node2", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "node1", "==", "null", "||", "node2", "==", "null", ")", "{", "return", "false", ";", "}", "return", "(", "(", "ASTNode", ")", "node1", ")", ".", "subtreeMatch", "(", "this", ",", "node2", ")", ";", "}", "public", "static", "boolean", "safeEquals", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "if", "(", "o1", "==", "o2", ")", "{", "return", "true", ";", "}", "if", "(", "o1", "==", "null", "||", "o2", "==", "null", ")", "{", "return", "false", ";", "}", "return", "o1", ".", "equals", "(", "o2", ")", ";", "}", "public", "boolean", "match", "(", "AnnotationTypeDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "AnnotationTypeDeclaration", ")", ")", "{", "return", "false", ";", "}", "AnnotationTypeDeclaration", "o", "=", "(", "AnnotationTypeDeclaration", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "bodyDeclarations", "(", ")", ",", "o", ".", "bodyDeclarations", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "AnnotationTypeMemberDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "AnnotationTypeMemberDeclaration", ")", ")", "{", "return", "false", ";", "}", "AnnotationTypeMemberDeclaration", "o", "=", "(", "AnnotationTypeMemberDeclaration", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getDefault", "(", ")", ",", "o", ".", "getDefault", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "AnonymousClassDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "AnonymousClassDeclaration", ")", ")", "{", "return", "false", ";", "}", "AnonymousClassDeclaration", "o", "=", "(", "AnonymousClassDeclaration", ")", "other", ";", "return", "safeSubtreeListMatch", "(", "node", ".", "bodyDeclarations", "(", ")", ",", "o", ".", "bodyDeclarations", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ArrayAccess", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ArrayAccess", ")", ")", "{", "return", "false", ";", "}", "ArrayAccess", "o", "=", "(", "ArrayAccess", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getArray", "(", ")", ",", "o", ".", "getArray", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getIndex", "(", ")", ",", "o", ".", "getIndex", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ArrayCreation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ArrayCreation", ")", ")", "{", "return", "false", ";", "}", "ArrayCreation", "o", "=", "(", "ArrayCreation", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "dimensions", "(", ")", ",", "o", ".", "dimensions", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getInitializer", "(", ")", ",", "o", ".", "getInitializer", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ArrayInitializer", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ArrayInitializer", ")", ")", "{", "return", "false", ";", "}", "ArrayInitializer", "o", "=", "(", "ArrayInitializer", ")", "other", ";", "return", "safeSubtreeListMatch", "(", "node", ".", "expressions", "(", ")", ",", "o", ".", "expressions", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ArrayType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ArrayType", ")", ")", "{", "return", "false", ";", "}", "ArrayType", "o", "=", "(", "ArrayType", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getComponentType", "(", ")", ",", "o", ".", "getComponentType", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "AssertStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "AssertStatement", ")", ")", "{", "return", "false", ";", "}", "AssertStatement", "o", "=", "(", "AssertStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getMessage", "(", ")", ",", "o", ".", "getMessage", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "Assignment", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "Assignment", ")", ")", "{", "return", "false", ";", "}", "Assignment", "o", "=", "(", "Assignment", ")", "other", ";", "return", "(", "node", ".", "getOperator", "(", ")", ".", "equals", "(", "o", ".", "getOperator", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getLeftHandSide", "(", ")", ",", "o", ".", "getLeftHandSide", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getRightHandSide", "(", ")", ",", "o", ".", "getRightHandSide", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "Block", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "Block", ")", ")", "{", "return", "false", ";", "}", "Block", "o", "=", "(", "Block", ")", "other", ";", "return", "safeSubtreeListMatch", "(", "node", ".", "statements", "(", ")", ",", "o", ".", "statements", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "BlockComment", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "BlockComment", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "match", "(", "BooleanLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "BooleanLiteral", ")", ")", "{", "return", "false", ";", "}", "BooleanLiteral", "o", "=", "(", "BooleanLiteral", ")", "other", ";", "return", "node", ".", "booleanValue", "(", ")", "==", "o", ".", "booleanValue", "(", ")", ";", "}", "public", "boolean", "match", "(", "BreakStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "BreakStatement", ")", ")", "{", "return", "false", ";", "}", "BreakStatement", "o", "=", "(", "BreakStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getLabel", "(", ")", ",", "o", ".", "getLabel", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "CastExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "CastExpression", ")", ")", "{", "return", "false", ";", "}", "CastExpression", "o", "=", "(", "CastExpression", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "CatchClause", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "CatchClause", ")", ")", "{", "return", "false", ";", "}", "CatchClause", "o", "=", "(", "CatchClause", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getException", "(", ")", ",", "o", ".", "getException", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "CharacterLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "CharacterLiteral", ")", ")", "{", "return", "false", ";", "}", "CharacterLiteral", "o", "=", "(", "CharacterLiteral", ")", "other", ";", "return", "safeEquals", "(", "node", ".", "getEscapedValue", "(", ")", ",", "o", ".", "getEscapedValue", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ClassInstanceCreation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ClassInstanceCreation", ")", ")", "{", "return", "false", ";", "}", "ClassInstanceCreation", "o", "=", "(", "ClassInstanceCreation", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "internalGetName", "(", ")", ",", "o", ".", "internalGetName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getAnonymousClassDeclaration", "(", ")", ",", "o", ".", "getAnonymousClassDeclaration", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "CompilationUnit", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "CompilationUnit", ")", ")", "{", "return", "false", ";", "}", "CompilationUnit", "o", "=", "(", "CompilationUnit", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getPackage", "(", ")", ",", "o", ".", "getPackage", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "imports", "(", ")", ",", "o", ".", "imports", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "types", "(", ")", ",", "o", ".", "types", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ConditionalExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ConditionalExpression", ")", ")", "{", "return", "false", ";", "}", "ConditionalExpression", "o", "=", "(", "ConditionalExpression", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getThenExpression", "(", ")", ",", "o", ".", "getThenExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getElseExpression", "(", ")", ",", "o", ".", "getElseExpression", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ConstructorInvocation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ConstructorInvocation", ")", ")", "{", "return", "false", ";", "}", "ConstructorInvocation", "o", "=", "(", "ConstructorInvocation", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ContinueStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ContinueStatement", ")", ")", "{", "return", "false", ";", "}", "ContinueStatement", "o", "=", "(", "ContinueStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getLabel", "(", ")", ",", "o", ".", "getLabel", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "UnionType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "UnionType", ")", ")", "{", "return", "false", ";", "}", "UnionType", "o", "=", "(", "UnionType", ")", "other", ";", "return", "safeSubtreeListMatch", "(", "node", ".", "types", "(", ")", ",", "o", ".", "types", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "DoStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "DoStatement", ")", ")", "{", "return", "false", ";", "}", "DoStatement", "o", "=", "(", "DoStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "EmptyStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "EmptyStatement", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "match", "(", "EnhancedForStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "EnhancedForStatement", ")", ")", "{", "return", "false", ";", "}", "EnhancedForStatement", "o", "=", "(", "EnhancedForStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getParameter", "(", ")", ",", "o", ".", "getParameter", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "EnumConstantDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "EnumConstantDeclaration", ")", ")", "{", "return", "false", ";", "}", "EnumConstantDeclaration", "o", "=", "(", "EnumConstantDeclaration", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getAnonymousClassDeclaration", "(", ")", ",", "o", ".", "getAnonymousClassDeclaration", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "EnumDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "EnumDeclaration", ")", ")", "{", "return", "false", ";", "}", "EnumDeclaration", "o", "=", "(", "EnumDeclaration", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "superInterfaceTypes", "(", ")", ",", "o", ".", "superInterfaceTypes", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "enumConstants", "(", ")", ",", "o", ".", "enumConstants", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "bodyDeclarations", "(", ")", ",", "o", ".", "bodyDeclarations", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ExpressionStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ExpressionStatement", ")", ")", "{", "return", "false", ";", "}", "ExpressionStatement", "o", "=", "(", "ExpressionStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "FieldAccess", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "FieldAccess", ")", ")", "{", "return", "false", ";", "}", "FieldAccess", "o", "=", "(", "FieldAccess", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "FieldDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "FieldDeclaration", ")", ")", "{", "return", "false", ";", "}", "FieldDeclaration", "o", "=", "(", "FieldDeclaration", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "fragments", "(", ")", ",", "o", ".", "fragments", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ForStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ForStatement", ")", ")", "{", "return", "false", ";", "}", "ForStatement", "o", "=", "(", "ForStatement", ")", "other", ";", "return", "(", "safeSubtreeListMatch", "(", "node", ".", "initializers", "(", ")", ",", "o", ".", "initializers", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "updaters", "(", ")", ",", "o", ".", "updaters", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "IfStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "IfStatement", ")", ")", "{", "return", "false", ";", "}", "IfStatement", "o", "=", "(", "IfStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getThenStatement", "(", ")", ",", "o", ".", "getThenStatement", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getElseStatement", "(", ")", ",", "o", ".", "getElseStatement", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ImportDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ImportDeclaration", ")", ")", "{", "return", "false", ";", "}", "ImportDeclaration", "o", "=", "(", "ImportDeclaration", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "node", ".", "isStatic", "(", ")", "!=", "o", ".", "isStatic", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "node", ".", "isOnDemand", "(", ")", "==", "o", ".", "isOnDemand", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "InfixExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "InfixExpression", ")", ")", "{", "return", "false", ";", "}", "InfixExpression", "o", "=", "(", "InfixExpression", ")", "other", ";", "if", "(", "node", ".", "hasExtendedOperands", "(", ")", "&&", "o", ".", "hasExtendedOperands", "(", ")", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "extendedOperands", "(", ")", ",", "o", ".", "extendedOperands", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "node", ".", "hasExtendedOperands", "(", ")", "!=", "o", ".", "hasExtendedOperands", "(", ")", ")", "{", "return", "false", ";", "}", "return", "(", "node", ".", "getOperator", "(", ")", ".", "equals", "(", "o", ".", "getOperator", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getLeftOperand", "(", ")", ",", "o", ".", "getLeftOperand", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getRightOperand", "(", ")", ",", "o", ".", "getRightOperand", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "InstanceofExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "InstanceofExpression", ")", ")", "{", "return", "false", ";", "}", "InstanceofExpression", "o", "=", "(", "InstanceofExpression", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getLeftOperand", "(", ")", ",", "o", ".", "getLeftOperand", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getRightOperand", "(", ")", ",", "o", ".", "getRightOperand", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "Initializer", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "Initializer", ")", ")", "{", "return", "false", ";", "}", "Initializer", "o", "=", "(", "Initializer", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "Javadoc", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "Javadoc", ")", ")", "{", "return", "false", ";", "}", "Javadoc", "o", "=", "(", "Javadoc", ")", "other", ";", "if", "(", "this", ".", "matchDocTags", ")", "{", "return", "safeSubtreeListMatch", "(", "node", ".", "tags", "(", ")", ",", "o", ".", "tags", "(", ")", ")", ";", "}", "else", "{", "return", "compareDeprecatedComment", "(", "node", ",", "o", ")", ";", "}", "}", "private", "boolean", "compareDeprecatedComment", "(", "Javadoc", "first", ",", "Javadoc", "second", ")", "{", "if", "(", "first", ".", "getAST", "(", ")", ".", "apiLevel", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "return", "safeEquals", "(", "first", ".", "getComment", "(", ")", ",", "second", ".", "getComment", "(", ")", ")", ";", "}", "else", "{", "return", "true", ";", "}", "}", "public", "boolean", "match", "(", "LabeledStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "LabeledStatement", ")", ")", "{", "return", "false", ";", "}", "LabeledStatement", "o", "=", "(", "LabeledStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getLabel", "(", ")", ",", "o", ".", "getLabel", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "LineComment", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "LineComment", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "match", "(", "MarkerAnnotation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MarkerAnnotation", ")", ")", "{", "return", "false", ";", "}", "MarkerAnnotation", "o", "=", "(", "MarkerAnnotation", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getTypeName", "(", ")", ",", "o", ".", "getTypeName", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "MemberRef", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MemberRef", ")", ")", "{", "return", "false", ";", "}", "MemberRef", "o", "=", "(", "MemberRef", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "MemberValuePair", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MemberValuePair", ")", ")", "{", "return", "false", ";", "}", "MemberValuePair", "o", "=", "(", "MemberValuePair", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getValue", "(", ")", ",", "o", ".", "getValue", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "MethodRef", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MethodRef", ")", ")", "{", "return", "false", ";", "}", "MethodRef", "o", "=", "(", "MethodRef", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "parameters", "(", ")", ",", "o", ".", "parameters", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "MethodRefParameter", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MethodRefParameter", ")", ")", "{", "return", "false", ";", "}", "MethodRefParameter", "o", "=", "(", "MethodRefParameter", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "node", ".", "isVarargs", "(", ")", "!=", "o", ".", "isVarargs", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "MethodDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MethodDeclaration", ")", ")", "{", "return", "false", ";", "}", "MethodDeclaration", "o", "=", "(", "MethodDeclaration", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "internalGetReturnType", "(", ")", ",", "o", ".", "internalGetReturnType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "getReturnType2", "(", ")", ",", "o", ".", "getReturnType2", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeParameters", "(", ")", ",", "o", ".", "typeParameters", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "(", "node", ".", "isConstructor", "(", ")", "==", "o", ".", "isConstructor", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "parameters", "(", ")", ",", "o", ".", "parameters", "(", ")", ")", "&&", "node", ".", "getExtraDimensions", "(", ")", "==", "o", ".", "getExtraDimensions", "(", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "thrownExceptions", "(", ")", ",", "o", ".", "thrownExceptions", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "MethodInvocation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "MethodInvocation", ")", ")", "{", "return", "false", ";", "}", "MethodInvocation", "o", "=", "(", "MethodInvocation", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "Modifier", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "Modifier", ")", ")", "{", "return", "false", ";", "}", "Modifier", "o", "=", "(", "Modifier", ")", "other", ";", "return", "(", "node", ".", "getKeyword", "(", ")", "==", "o", ".", "getKeyword", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "NormalAnnotation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "NormalAnnotation", ")", ")", "{", "return", "false", ";", "}", "NormalAnnotation", "o", "=", "(", "NormalAnnotation", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getTypeName", "(", ")", ",", "o", ".", "getTypeName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "values", "(", ")", ",", "o", ".", "values", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "NullLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "NullLiteral", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "match", "(", "NumberLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "NumberLiteral", ")", ")", "{", "return", "false", ";", "}", "NumberLiteral", "o", "=", "(", "NumberLiteral", ")", "other", ";", "return", "safeEquals", "(", "node", ".", "getToken", "(", ")", ",", "o", ".", "getToken", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "PackageDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "PackageDeclaration", ")", ")", "{", "return", "false", ";", "}", "PackageDeclaration", "o", "=", "(", "PackageDeclaration", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "annotations", "(", ")", ",", "o", ".", "annotations", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ParameterizedType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ParameterizedType", ")", ")", "{", "return", "false", ";", "}", "ParameterizedType", "o", "=", "(", "ParameterizedType", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ParenthesizedExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ParenthesizedExpression", ")", ")", "{", "return", "false", ";", "}", "ParenthesizedExpression", "o", "=", "(", "ParenthesizedExpression", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "PostfixExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "PostfixExpression", ")", ")", "{", "return", "false", ";", "}", "PostfixExpression", "o", "=", "(", "PostfixExpression", ")", "other", ";", "return", "(", "node", ".", "getOperator", "(", ")", ".", "equals", "(", "o", ".", "getOperator", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getOperand", "(", ")", ",", "o", ".", "getOperand", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "PrefixExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "PrefixExpression", ")", ")", "{", "return", "false", ";", "}", "PrefixExpression", "o", "=", "(", "PrefixExpression", ")", "other", ";", "return", "(", "node", ".", "getOperator", "(", ")", ".", "equals", "(", "o", ".", "getOperator", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getOperand", "(", ")", ",", "o", ".", "getOperand", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "PrimitiveType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "PrimitiveType", ")", ")", "{", "return", "false", ";", "}", "PrimitiveType", "o", "=", "(", "PrimitiveType", ")", "other", ";", "return", "(", "node", ".", "getPrimitiveTypeCode", "(", ")", "==", "o", ".", "getPrimitiveTypeCode", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "QualifiedName", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "QualifiedName", ")", ")", "{", "return", "false", ";", "}", "QualifiedName", "o", "=", "(", "QualifiedName", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "QualifiedType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "QualifiedType", ")", ")", "{", "return", "false", ";", "}", "QualifiedType", "o", "=", "(", "QualifiedType", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "ReturnStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ReturnStatement", ")", ")", "{", "return", "false", ";", "}", "ReturnStatement", "o", "=", "(", "ReturnStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "SimpleName", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SimpleName", ")", ")", "{", "return", "false", ";", "}", "SimpleName", "o", "=", "(", "SimpleName", ")", "other", ";", "return", "node", ".", "getIdentifier", "(", ")", ".", "equals", "(", "o", ".", "getIdentifier", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "SimpleType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SimpleType", ")", ")", "{", "return", "false", ";", "}", "SimpleType", "o", "=", "(", "SimpleType", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "SingleMemberAnnotation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SingleMemberAnnotation", ")", ")", "{", "return", "false", ";", "}", "SingleMemberAnnotation", "o", "=", "(", "SingleMemberAnnotation", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getTypeName", "(", ")", ",", "o", ".", "getTypeName", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getValue", "(", ")", ",", "o", ".", "getValue", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "SingleVariableDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SingleVariableDeclaration", ")", ")", "{", "return", "false", ";", "}", "SingleVariableDeclaration", "o", "=", "(", "SingleVariableDeclaration", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "node", ".", "isVarargs", "(", ")", "!=", "o", ".", "isVarargs", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "node", ".", "getExtraDimensions", "(", ")", "==", "o", ".", "getExtraDimensions", "(", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getInitializer", "(", ")", ",", "o", ".", "getInitializer", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "StringLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "StringLiteral", ")", ")", "{", "return", "false", ";", "}", "StringLiteral", "o", "=", "(", "StringLiteral", ")", "other", ";", "return", "safeEquals", "(", "node", ".", "getEscapedValue", "(", ")", ",", "o", ".", "getEscapedValue", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "SuperConstructorInvocation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SuperConstructorInvocation", ")", ")", "{", "return", "false", ";", "}", "SuperConstructorInvocation", "o", "=", "(", "SuperConstructorInvocation", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "SuperFieldAccess", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SuperFieldAccess", ")", ")", "{", "return", "false", ";", "}", "SuperFieldAccess", "o", "=", "(", "SuperFieldAccess", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "SuperMethodInvocation", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SuperMethodInvocation", ")", ")", "{", "return", "false", ";", "}", "SuperMethodInvocation", "o", "=", "(", "SuperMethodInvocation", ")", "other", ";", "if", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeArguments", "(", ")", ",", "o", ".", "typeArguments", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "arguments", "(", ")", ",", "o", ".", "arguments", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "SwitchCase", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SwitchCase", ")", ")", "{", "return", "false", ";", "}", "SwitchCase", "o", "=", "(", "SwitchCase", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "SwitchStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SwitchStatement", ")", ")", "{", "return", "false", ";", "}", "SwitchStatement", "o", "=", "(", "SwitchStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "statements", "(", ")", ",", "o", ".", "statements", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "SynchronizedStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "SynchronizedStatement", ")", ")", "{", "return", "false", ";", "}", "SynchronizedStatement", "o", "=", "(", "SynchronizedStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "TagElement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TagElement", ")", ")", "{", "return", "false", ";", "}", "TagElement", "o", "=", "(", "TagElement", ")", "other", ";", "return", "(", "safeEquals", "(", "node", ".", "getTagName", "(", ")", ",", "o", ".", "getTagName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "fragments", "(", ")", ",", "o", ".", "fragments", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "TextElement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TextElement", ")", ")", "{", "return", "false", ";", "}", "TextElement", "o", "=", "(", "TextElement", ")", "other", ";", "return", "safeEquals", "(", "node", ".", "getText", "(", ")", ",", "o", ".", "getText", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ThisExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ThisExpression", ")", ")", "{", "return", "false", ";", "}", "ThisExpression", "o", "=", "(", "ThisExpression", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getQualifier", "(", ")", ",", "o", ".", "getQualifier", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "ThrowStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ThrowStatement", ")", ")", "{", "return", "false", ";", "}", "ThrowStatement", "o", "=", "(", "ThrowStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "TryStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TryStatement", ")", ")", "{", "return", "false", ";", "}", "TryStatement", "o", "=", "(", "TryStatement", ")", "other", ";", "switch", "(", "node", ".", "getAST", "(", ")", ".", "apiLevel", ")", "{", "case", "AST", ".", "JLS2_INTERNAL", ":", "case", "AST", ".", "JLS3_INTERNAL", ":", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "catchClauses", "(", ")", ",", "o", ".", "catchClauses", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getFinally", "(", ")", ",", "o", ".", "getFinally", "(", ")", ")", ")", ";", "}", "return", "(", "safeSubtreeListMatch", "(", "node", ".", "resources", "(", ")", ",", "o", ".", "resources", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "catchClauses", "(", ")", ",", "o", ".", "catchClauses", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getFinally", "(", ")", ",", "o", ".", "getFinally", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "TypeDeclaration", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TypeDeclaration", ")", ")", "{", "return", "false", ";", "}", "TypeDeclaration", "o", "=", "(", "TypeDeclaration", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "internalGetSuperclass", "(", ")", ",", "o", ".", "internalGetSuperclass", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "internalSuperInterfaces", "(", ")", ",", "o", ".", "internalSuperInterfaces", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "typeParameters", "(", ")", ",", "o", ".", "typeParameters", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeMatch", "(", "node", ".", "getSuperclassType", "(", ")", ",", "o", ".", "getSuperclassType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "superInterfaceTypes", "(", ")", ",", "o", ".", "superInterfaceTypes", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "(", "(", "node", ".", "isInterface", "(", ")", "==", "o", ".", "isInterface", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getJavadoc", "(", ")", ",", "o", ".", "getJavadoc", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "bodyDeclarations", "(", ")", ",", "o", ".", "bodyDeclarations", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "TypeDeclarationStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TypeDeclarationStatement", ")", ")", "{", "return", "false", ";", "}", "TypeDeclarationStatement", "o", "=", "(", "TypeDeclarationStatement", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getDeclaration", "(", ")", ",", "o", ".", "getDeclaration", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "TypeLiteral", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TypeLiteral", ")", ")", "{", "return", "false", ";", "}", "TypeLiteral", "o", "=", "(", "TypeLiteral", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "TypeParameter", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "TypeParameter", ")", ")", "{", "return", "false", ";", "}", "TypeParameter", "o", "=", "(", "TypeParameter", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "typeBounds", "(", ")", ",", "o", ".", "typeBounds", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "VariableDeclarationExpression", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "VariableDeclarationExpression", ")", ")", "{", "return", "false", ";", "}", "VariableDeclarationExpression", "o", "=", "(", "VariableDeclarationExpression", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "fragments", "(", ")", ",", "o", ".", "fragments", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "VariableDeclarationFragment", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "VariableDeclarationFragment", ")", ")", "{", "return", "false", ";", "}", "VariableDeclarationFragment", "o", "=", "(", "VariableDeclarationFragment", ")", "other", ";", "return", "safeSubtreeMatch", "(", "node", ".", "getName", "(", ")", ",", "o", ".", "getName", "(", ")", ")", "&&", "node", ".", "getExtraDimensions", "(", ")", "==", "o", ".", "getExtraDimensions", "(", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getInitializer", "(", ")", ",", "o", ".", "getInitializer", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "VariableDeclarationStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "VariableDeclarationStatement", ")", ")", "{", "return", "false", ";", "}", "VariableDeclarationStatement", "o", "=", "(", "VariableDeclarationStatement", ")", "other", ";", "int", "level", "=", "node", ".", "getAST", "(", ")", ".", "apiLevel", ";", "if", "(", "level", "==", "AST", ".", "JLS2_INTERNAL", ")", "{", "if", "(", "node", ".", "getModifiers", "(", ")", "!=", "o", ".", "getModifiers", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "level", ">=", "AST", ".", "JLS3_INTERNAL", ")", "{", "if", "(", "!", "safeSubtreeListMatch", "(", "node", ".", "modifiers", "(", ")", ",", "o", ".", "modifiers", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "safeSubtreeMatch", "(", "node", ".", "getType", "(", ")", ",", "o", ".", "getType", "(", ")", ")", "&&", "safeSubtreeListMatch", "(", "node", ".", "fragments", "(", ")", ",", "o", ".", "fragments", "(", ")", ")", ";", "}", "public", "boolean", "match", "(", "WhileStatement", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "WhileStatement", ")", ")", "{", "return", "false", ";", "}", "WhileStatement", "o", "=", "(", "WhileStatement", ")", "other", ";", "return", "(", "safeSubtreeMatch", "(", "node", ".", "getExpression", "(", ")", ",", "o", ".", "getExpression", "(", ")", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBody", "(", ")", ",", "o", ".", "getBody", "(", ")", ")", ")", ";", "}", "public", "boolean", "match", "(", "WildcardType", "node", ",", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "WildcardType", ")", ")", "{", "return", "false", ";", "}", "WildcardType", "o", "=", "(", "WildcardType", ")", "other", ";", "return", "node", ".", "isUpperBound", "(", ")", "==", "o", ".", "isUpperBound", "(", ")", "&&", "safeSubtreeMatch", "(", "node", ".", "getBound", "(", ")", ",", "o", ".", "getBound", "(", ")", ")", ";", "}", "}", "</s>" ]
2,394
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "public", "interface", "ITypeBinding", "extends", "IBinding", "{", "public", "ITypeBinding", "createArrayType", "(", "int", "dimension", ")", ";", "public", "String", "getBinaryName", "(", ")", ";", "public", "ITypeBinding", "getBound", "(", ")", ";", "public", "ITypeBinding", "getGenericTypeOfWildcardType", "(", ")", ";", "public", "int", "getRank", "(", ")", ";", "public", "ITypeBinding", "getComponentType", "(", ")", ";", "public", "IVariableBinding", "[", "]", "getDeclaredFields", "(", ")", ";", "public", "IMethodBinding", "[", "]", "getDeclaredMethods", "(", ")", ";", "public", "int", "getDeclaredModifiers", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getDeclaredTypes", "(", ")", ";", "public", "ITypeBinding", "getDeclaringClass", "(", ")", ";", "public", "IMethodBinding", "getDeclaringMethod", "(", ")", ";", "public", "int", "getDimensions", "(", ")", ";", "public", "ITypeBinding", "getElementType", "(", ")", ";", "public", "ITypeBinding", "getErasure", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getInterfaces", "(", ")", ";", "public", "int", "getModifiers", "(", ")", ";", "public", "String", "getName", "(", ")", ";", "public", "IPackageBinding", "getPackage", "(", ")", ";", "public", "String", "getQualifiedName", "(", ")", ";", "public", "ITypeBinding", "getSuperclass", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getTypeArguments", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getTypeBounds", "(", ")", ";", "public", "ITypeBinding", "getTypeDeclaration", "(", ")", ";", "public", "ITypeBinding", "[", "]", "getTypeParameters", "(", ")", ";", "public", "ITypeBinding", "getWildcard", "(", ")", ";", "public", "boolean", "isAnnotation", "(", ")", ";", "public", "boolean", "isAnonymous", "(", ")", ";", "public", "boolean", "isArray", "(", ")", ";", "public", "boolean", "isAssignmentCompatible", "(", "ITypeBinding", "variableType", ")", ";", "public", "boolean", "isCapture", "(", ")", ";", "public", "boolean", "isCastCompatible", "(", "ITypeBinding", "type", ")", ";", "public", "boolean", "isClass", "(", ")", ";", "public", "boolean", "isEnum", "(", ")", ";", "public", "boolean", "isFromSource", "(", ")", ";", "public", "boolean", "isGenericType", "(", ")", ";", "public", "boolean", "isInterface", "(", ")", ";", "public", "boolean", "isLocal", "(", ")", ";", "public", "boolean", "isMember", "(", ")", ";", "public", "boolean", "isNested", "(", ")", ";", "public", "boolean", "isNullType", "(", ")", ";", "public", "boolean", "isParameterizedType", "(", ")", ";", "public", "boolean", "isPrimitive", "(", ")", ";", "public", "boolean", "isRawType", "(", ")", ";", "public", "boolean", "isSubTypeCompatible", "(", "ITypeBinding", "type", ")", ";", "public", "boolean", "isTopLevel", "(", ")", ";", "public", "boolean", "isTypeVariable", "(", ")", ";", "public", "boolean", "isUpperbound", "(", ")", ";", "public", "boolean", "isWildcardType", "(", ")", ";", "}", "</s>" ]
2,395
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "StringTokenizer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "final", "class", "AST", "{", "private", "static", "final", "Class", "[", "]", "AST_CLASS", "=", "new", "Class", "[", "]", "{", "AST", ".", "class", "}", ";", "public", "static", "final", "int", "JLS2", "=", "2", ";", "static", "final", "int", "JLS2_INTERNAL", "=", "JLS2", ";", "public", "static", "final", "int", "JLS3", "=", "3", ";", "static", "final", "int", "JLS3_INTERNAL", "=", "JLS3", ";", "public", "static", "final", "int", "JLS4", "=", "4", ";", "static", "final", "int", "RESOLVED_BINDINGS", "=", "0x80000000", ";", "public", "static", "CompilationUnit", "convertCompilationUnit", "(", "int", "level", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", "compilationUnitDeclaration", ",", "char", "[", "]", "source", ",", "Map", "options", ",", "boolean", "isResolved", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", "workingCopy", ",", "int", "reconcileFlags", ",", "IProgressMonitor", "monitor", ")", "{", "return", "null", ";", "}", "public", "static", "CompilationUnit", "convertCompilationUnit", "(", "int", "level", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", "compilationUnitDeclaration", ",", "Map", "options", ",", "boolean", "isResolved", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", "workingCopy", ",", "int", "reconcileFlags", ",", "IProgressMonitor", "monitor", ")", "{", "ASTConverter", "converter", "=", "new", "ASTConverter", "(", "options", ",", "isResolved", ",", "monitor", ")", ";", "AST", "ast", "=", "AST", ".", "newAST", "(", "level", ")", ";", "int", "savedDefaultNodeFlag", "=", "ast", ".", "getDefaultNodeFlag", "(", ")", ";", "ast", ".", "setDefaultNodeFlag", "(", "ASTNode", ".", "ORIGINAL", ")", ";", "BindingResolver", "resolver", "=", "null", ";", "if", "(", "isResolved", ")", "{", "resolver", "=", "new", "DefaultBindingResolver", "(", "compilationUnitDeclaration", ".", "scope", ",", "workingCopy", ".", "owner", ",", "new", "DefaultBindingResolver", ".", "BindingTables", "(", ")", ",", "false", ",", "true", ")", ";", "(", "(", "DefaultBindingResolver", ")", "resolver", ")", ".", "isRecoveringBindings", "=", "(", "reconcileFlags", "&", "ICompilationUnit", ".", "ENABLE_BINDINGS_RECOVERY", ")", "!=", "0", ";", "ast", ".", "setFlag", "(", "AST", ".", "RESOLVED_BINDINGS", ")", ";", "}", "else", "{", "resolver", "=", "new", "BindingResolver", "(", ")", ";", "}", "ast", ".", "setFlag", "(", "reconcileFlags", ")", ";", "ast", ".", "setBindingResolver", "(", "resolver", ")", ";", "converter", ".", "setAST", "(", "ast", ")", ";", "CompilationUnit", "unit", "=", "converter", ".", "convert", "(", "compilationUnitDeclaration", ",", "workingCopy", ".", "getContents", "(", ")", ")", ";", "unit", ".", "setLineEndTable", "(", "compilationUnitDeclaration", ".", "compilationResult", ".", "getLineSeparatorPositions", "(", ")", ")", ";", "unit", ".", "setTypeRoot", "(", "workingCopy", ".", "originalFromClone", "(", ")", ")", ";", "ast", ".", "setDefaultNodeFlag", "(", "savedDefaultNodeFlag", ")", ";", "return", "unit", ";", "}", "public", "static", "AST", "newAST", "(", "int", "level", ")", "{", "return", "new", "AST", "(", "level", ")", ";", "}", "public", "static", "CompilationUnit", "parseCompilationUnit", "(", "char", "[", "]", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTParser", "c", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS2", ")", ";", "c", ".", "setSource", "(", "source", ")", ";", "ASTNode", "result", "=", "c", ".", "createAST", "(", "null", ")", ";", "return", "(", "CompilationUnit", ")", "result", ";", "}", "public", "static", "CompilationUnit", "parseCompilationUnit", "(", "char", "[", "]", "source", ",", "String", "unitName", ",", "IJavaProject", "project", ")", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTParser", "astParser", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS2", ")", ";", "astParser", ".", "setSource", "(", "source", ")", ";", "astParser", ".", "setUnitName", "(", "unitName", ")", ";", "astParser", ".", "setProject", "(", "project", ")", ";", "astParser", ".", "setResolveBindings", "(", "project", "!=", "null", ")", ";", "ASTNode", "result", "=", "astParser", ".", "createAST", "(", "null", ")", ";", "return", "(", "CompilationUnit", ")", "result", ";", "}", "public", "static", "CompilationUnit", "parseCompilationUnit", "(", "IClassFile", "classFile", ",", "boolean", "resolveBindings", ")", "{", "if", "(", "classFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "try", "{", "ASTParser", "c", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS2", ")", ";", "c", ".", "setSource", "(", "classFile", ")", ";", "c", ".", "setResolveBindings", "(", "resolveBindings", ")", ";", "ASTNode", "result", "=", "c", ".", "createAST", "(", "null", ")", ";", "return", "(", "CompilationUnit", ")", "result", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "public", "static", "CompilationUnit", "parseCompilationUnit", "(", "ICompilationUnit", "unit", ",", "boolean", "resolveBindings", ")", "{", "try", "{", "ASTParser", "c", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS2", ")", ";", "c", ".", "setSource", "(", "unit", ")", ";", "c", ".", "setResolveBindings", "(", "resolveBindings", ")", ";", "ASTNode", "result", "=", "c", ".", "createAST", "(", "null", ")", ";", "return", "(", "CompilationUnit", ")", "result", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "int", "apiLevel", ";", "private", "int", "bits", ";", "private", "int", "defaultNodeFlag", "=", "0", ";", "private", "int", "disableEvents", "=", "0", ";", "private", "NodeEventHandler", "eventHandler", "=", "new", "NodeEventHandler", "(", ")", ";", "private", "final", "Object", "internalASTLock", "=", "new", "Object", "(", ")", ";", "private", "long", "modificationCount", "=", "0", ";", "private", "long", "originalModificationCount", "=", "0", ";", "private", "BindingResolver", "resolver", "=", "new", "BindingResolver", "(", ")", ";", "InternalASTRewrite", "rewriter", ";", "Scanner", "scanner", ";", "private", "final", "Object", "[", "]", "THIS_AST", "=", "new", "Object", "[", "]", "{", "this", "}", ";", "public", "AST", "(", ")", "{", "this", "(", "JavaCore", ".", "getDefaultOptions", "(", ")", ")", ";", "}", "private", "AST", "(", "int", "level", ")", "{", "switch", "(", "level", ")", "{", "case", "JLS2_INTERNAL", ":", "case", "JLS3_INTERNAL", ":", "this", ".", "apiLevel", "=", "level", ";", "this", ".", "scanner", "=", "new", "Scanner", "(", "true", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_3", ",", "ClassFileConstants", ".", "JDK1_5", ",", "null", ",", "null", ",", "true", ")", ";", "break", ";", "case", "JLS4", ":", "this", ".", "apiLevel", "=", "level", ";", "this", ".", "scanner", "=", "new", "Scanner", "(", "true", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_7", ",", "ClassFileConstants", ".", "JDK1_7", ",", "null", ",", "null", ",", "true", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "public", "AST", "(", "Map", "options", ")", "{", "this", "(", "JLS2", ")", ";", "Object", "sourceLevelOption", "=", "options", ".", "get", "(", "JavaCore", ".", "COMPILER_SOURCE", ")", ";", "long", "sourceLevel", "=", "ClassFileConstants", ".", "JDK1_3", ";", "if", "(", "JavaCore", ".", "VERSION_1_4", ".", "equals", "(", "sourceLevelOption", ")", ")", "{", "sourceLevel", "=", "ClassFileConstants", ".", "JDK1_4", ";", "}", "else", "if", "(", "JavaCore", ".", "VERSION_1_5", ".", "equals", "(", "sourceLevelOption", ")", ")", "{", "sourceLevel", "=", "ClassFileConstants", ".", "JDK1_5", ";", "}", "else", "if", "(", "JavaCore", ".", "VERSION_1_7", ".", "equals", "(", "sourceLevelOption", ")", ")", "{", "sourceLevel", "=", "ClassFileConstants", ".", "JDK1_7", ";", "}", "Object", "complianceLevelOption", "=", "options", ".", "get", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ")", ";", "long", "complianceLevel", "=", "ClassFileConstants", ".", "JDK1_3", ";", "if", "(", "JavaCore", ".", "VERSION_1_4", ".", "equals", "(", "complianceLevelOption", ")", ")", "{", "complianceLevel", "=", "ClassFileConstants", ".", "JDK1_4", ";", "}", "else", "if", "(", "JavaCore", ".", "VERSION_1_5", ".", "equals", "(", "complianceLevelOption", ")", ")", "{", "complianceLevel", "=", "ClassFileConstants", ".", "JDK1_5", ";", "}", "else", "if", "(", "JavaCore", ".", "VERSION_1_7", ".", "equals", "(", "complianceLevelOption", ")", ")", "{", "complianceLevel", "=", "ClassFileConstants", ".", "JDK1_7", ";", "}", "this", ".", "scanner", "=", "new", "Scanner", "(", "true", ",", "true", ",", "false", ",", "sourceLevel", ",", "complianceLevel", ",", "null", ",", "null", ",", "true", ")", ";", "}", "public", "int", "apiLevel", "(", ")", "{", "return", "this", ".", "apiLevel", ";", "}", "public", "ASTNode", "createInstance", "(", "Class", "nodeClass", ")", "{", "if", "(", "nodeClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "try", "{", "Constructor", "c", "=", "nodeClass", ".", "getDeclaredConstructor", "(", "AST_CLASS", ")", ";", "Object", "result", "=", "c", ".", "newInstance", "(", "this", ".", "THIS_AST", ")", ";", "return", "(", "ASTNode", ")", "result", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "public", "ASTNode", "createInstance", "(", "int", "nodeType", ")", "{", "Class", "nodeClass", "=", "ASTNode", ".", "nodeClassForType", "(", "nodeType", ")", ";", "return", "createInstance", "(", "nodeClass", ")", ";", "}", "final", "void", "disableEvents", "(", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "this", ".", "disableEvents", "++", ";", "}", "}", "BindingResolver", "getBindingResolver", "(", ")", "{", "return", "this", ".", "resolver", ";", "}", "int", "getDefaultNodeFlag", "(", ")", "{", "return", "this", ".", "defaultNodeFlag", ";", "}", "NodeEventHandler", "getEventHandler", "(", ")", "{", "return", "this", ".", "eventHandler", ";", "}", "public", "boolean", "hasBindingsRecovery", "(", ")", "{", "return", "(", "this", ".", "bits", "&", "ICompilationUnit", ".", "ENABLE_BINDINGS_RECOVERY", ")", "!=", "0", ";", "}", "public", "boolean", "hasResolvedBindings", "(", ")", "{", "return", "(", "this", ".", "bits", "&", "RESOLVED_BINDINGS", ")", "!=", "0", ";", "}", "public", "boolean", "hasStatementsRecovery", "(", ")", "{", "return", "(", "this", ".", "bits", "&", "ICompilationUnit", ".", "ENABLE_STATEMENTS_RECOVERY", ")", "!=", "0", ";", "}", "Name", "internalNewName", "(", "String", "[", "]", "identifiers", ")", "{", "int", "count", "=", "identifiers", ".", "length", ";", "if", "(", "count", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "final", "SimpleName", "simpleName", "=", "new", "SimpleName", "(", "this", ")", ";", "simpleName", ".", "internalSetIdentifier", "(", "identifiers", "[", "0", "]", ")", ";", "Name", "result", "=", "simpleName", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "count", ";", "i", "++", ")", "{", "SimpleName", "name", "=", "new", "SimpleName", "(", "this", ")", ";", "name", ".", "internalSetIdentifier", "(", "identifiers", "[", "i", "]", ")", ";", "result", "=", "newQualifiedName", "(", "result", ",", "name", ")", ";", "}", "return", "result", ";", "}", "public", "long", "modificationCount", "(", ")", "{", "return", "this", ".", "modificationCount", ";", "}", "void", "modifying", "(", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "this", ".", "modificationCount", "++", ";", "}", "public", "AnnotationTypeDeclaration", "newAnnotationTypeDeclaration", "(", ")", "{", "AnnotationTypeDeclaration", "result", "=", "new", "AnnotationTypeDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "AnnotationTypeMemberDeclaration", "newAnnotationTypeMemberDeclaration", "(", ")", "{", "AnnotationTypeMemberDeclaration", "result", "=", "new", "AnnotationTypeMemberDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "AnonymousClassDeclaration", "newAnonymousClassDeclaration", "(", ")", "{", "AnonymousClassDeclaration", "result", "=", "new", "AnonymousClassDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ArrayAccess", "newArrayAccess", "(", ")", "{", "ArrayAccess", "result", "=", "new", "ArrayAccess", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ArrayCreation", "newArrayCreation", "(", ")", "{", "ArrayCreation", "result", "=", "new", "ArrayCreation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ArrayInitializer", "newArrayInitializer", "(", ")", "{", "ArrayInitializer", "result", "=", "new", "ArrayInitializer", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ArrayType", "newArrayType", "(", "Type", "componentType", ")", "{", "ArrayType", "result", "=", "new", "ArrayType", "(", "this", ")", ";", "result", ".", "setComponentType", "(", "componentType", ")", ";", "return", "result", ";", "}", "public", "ArrayType", "newArrayType", "(", "Type", "elementType", ",", "int", "dimensions", ")", "{", "if", "(", "elementType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "dimensions", "<", "1", "||", "dimensions", ">", "1000", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ArrayType", "result", "=", "new", "ArrayType", "(", "this", ")", ";", "result", ".", "setComponentType", "(", "elementType", ")", ";", "for", "(", "int", "i", "=", "2", ";", "i", "<=", "dimensions", ";", "i", "++", ")", "{", "result", "=", "newArrayType", "(", "result", ")", ";", "}", "return", "result", ";", "}", "public", "AssertStatement", "newAssertStatement", "(", ")", "{", "return", "new", "AssertStatement", "(", "this", ")", ";", "}", "public", "Assignment", "newAssignment", "(", ")", "{", "Assignment", "result", "=", "new", "Assignment", "(", "this", ")", ";", "return", "result", ";", "}", "public", "Block", "newBlock", "(", ")", "{", "return", "new", "Block", "(", "this", ")", ";", "}", "public", "BlockComment", "newBlockComment", "(", ")", "{", "BlockComment", "result", "=", "new", "BlockComment", "(", "this", ")", ";", "return", "result", ";", "}", "public", "BooleanLiteral", "newBooleanLiteral", "(", "boolean", "value", ")", "{", "BooleanLiteral", "result", "=", "new", "BooleanLiteral", "(", "this", ")", ";", "result", ".", "setBooleanValue", "(", "value", ")", ";", "return", "result", ";", "}", "public", "BreakStatement", "newBreakStatement", "(", ")", "{", "return", "new", "BreakStatement", "(", "this", ")", ";", "}", "public", "CastExpression", "newCastExpression", "(", ")", "{", "CastExpression", "result", "=", "new", "CastExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "CatchClause", "newCatchClause", "(", ")", "{", "return", "new", "CatchClause", "(", "this", ")", ";", "}", "public", "CharacterLiteral", "newCharacterLiteral", "(", ")", "{", "return", "new", "CharacterLiteral", "(", "this", ")", ";", "}", "public", "ClassInstanceCreation", "newClassInstanceCreation", "(", ")", "{", "ClassInstanceCreation", "result", "=", "new", "ClassInstanceCreation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "CompilationUnit", "newCompilationUnit", "(", ")", "{", "return", "new", "CompilationUnit", "(", "this", ")", ";", "}", "public", "ConditionalExpression", "newConditionalExpression", "(", ")", "{", "ConditionalExpression", "result", "=", "new", "ConditionalExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ConstructorInvocation", "newConstructorInvocation", "(", ")", "{", "ConstructorInvocation", "result", "=", "new", "ConstructorInvocation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ContinueStatement", "newContinueStatement", "(", ")", "{", "return", "new", "ContinueStatement", "(", "this", ")", ";", "}", "public", "UnionType", "newUnionType", "(", ")", "{", "return", "new", "UnionType", "(", "this", ")", ";", "}", "public", "DoStatement", "newDoStatement", "(", ")", "{", "return", "new", "DoStatement", "(", "this", ")", ";", "}", "public", "EmptyStatement", "newEmptyStatement", "(", ")", "{", "return", "new", "EmptyStatement", "(", "this", ")", ";", "}", "public", "EnhancedForStatement", "newEnhancedForStatement", "(", ")", "{", "return", "new", "EnhancedForStatement", "(", "this", ")", ";", "}", "public", "EnumConstantDeclaration", "newEnumConstantDeclaration", "(", ")", "{", "EnumConstantDeclaration", "result", "=", "new", "EnumConstantDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "EnumDeclaration", "newEnumDeclaration", "(", ")", "{", "EnumDeclaration", "result", "=", "new", "EnumDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ExpressionStatement", "newExpressionStatement", "(", "Expression", "expression", ")", "{", "ExpressionStatement", "result", "=", "new", "ExpressionStatement", "(", "this", ")", ";", "result", ".", "setExpression", "(", "expression", ")", ";", "return", "result", ";", "}", "public", "FieldAccess", "newFieldAccess", "(", ")", "{", "FieldAccess", "result", "=", "new", "FieldAccess", "(", "this", ")", ";", "return", "result", ";", "}", "public", "FieldDeclaration", "newFieldDeclaration", "(", "VariableDeclarationFragment", "fragment", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "FieldDeclaration", "result", "=", "new", "FieldDeclaration", "(", "this", ")", ";", "result", ".", "fragments", "(", ")", ".", "add", "(", "fragment", ")", ";", "return", "result", ";", "}", "public", "ForStatement", "newForStatement", "(", ")", "{", "return", "new", "ForStatement", "(", "this", ")", ";", "}", "public", "IfStatement", "newIfStatement", "(", ")", "{", "return", "new", "IfStatement", "(", "this", ")", ";", "}", "public", "ImportDeclaration", "newImportDeclaration", "(", ")", "{", "ImportDeclaration", "result", "=", "new", "ImportDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "InfixExpression", "newInfixExpression", "(", ")", "{", "InfixExpression", "result", "=", "new", "InfixExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "Initializer", "newInitializer", "(", ")", "{", "Initializer", "result", "=", "new", "Initializer", "(", "this", ")", ";", "return", "result", ";", "}", "public", "InstanceofExpression", "newInstanceofExpression", "(", ")", "{", "InstanceofExpression", "result", "=", "new", "InstanceofExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "Javadoc", "newJavadoc", "(", ")", "{", "Javadoc", "result", "=", "new", "Javadoc", "(", "this", ")", ";", "return", "result", ";", "}", "public", "LabeledStatement", "newLabeledStatement", "(", ")", "{", "return", "new", "LabeledStatement", "(", "this", ")", ";", "}", "public", "LineComment", "newLineComment", "(", ")", "{", "LineComment", "result", "=", "new", "LineComment", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MarkerAnnotation", "newMarkerAnnotation", "(", ")", "{", "MarkerAnnotation", "result", "=", "new", "MarkerAnnotation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MemberRef", "newMemberRef", "(", ")", "{", "MemberRef", "result", "=", "new", "MemberRef", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MemberValuePair", "newMemberValuePair", "(", ")", "{", "MemberValuePair", "result", "=", "new", "MemberValuePair", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MethodDeclaration", "newMethodDeclaration", "(", ")", "{", "MethodDeclaration", "result", "=", "new", "MethodDeclaration", "(", "this", ")", ";", "result", ".", "setConstructor", "(", "false", ")", ";", "return", "result", ";", "}", "public", "MethodInvocation", "newMethodInvocation", "(", ")", "{", "MethodInvocation", "result", "=", "new", "MethodInvocation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MethodRef", "newMethodRef", "(", ")", "{", "MethodRef", "result", "=", "new", "MethodRef", "(", "this", ")", ";", "return", "result", ";", "}", "public", "MethodRefParameter", "newMethodRefParameter", "(", ")", "{", "MethodRefParameter", "result", "=", "new", "MethodRefParameter", "(", "this", ")", ";", "return", "result", ";", "}", "public", "Modifier", "newModifier", "(", "Modifier", ".", "ModifierKeyword", "keyword", ")", "{", "Modifier", "result", "=", "new", "Modifier", "(", "this", ")", ";", "result", ".", "setKeyword", "(", "keyword", ")", ";", "return", "result", ";", "}", "public", "List", "newModifiers", "(", "int", "flags", ")", "{", "if", "(", "this", ".", "apiLevel", "==", "AST", ".", "JLS2", ")", "{", "unsupportedIn2", "(", ")", ";", "}", "List", "result", "=", "new", "ArrayList", "(", "3", ")", ";", "if", "(", "Modifier", ".", "isPublic", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "PUBLIC_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isProtected", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "PROTECTED_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isPrivate", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "PRIVATE_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isAbstract", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "ABSTRACT_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isStatic", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "STATIC_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isFinal", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "FINAL_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isSynchronized", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "SYNCHRONIZED_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isNative", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "NATIVE_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isStrictfp", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "STRICTFP_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isTransient", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "TRANSIENT_KEYWORD", ")", ")", ";", "}", "if", "(", "Modifier", ".", "isVolatile", "(", "flags", ")", ")", "{", "result", ".", "add", "(", "newModifier", "(", "Modifier", ".", "ModifierKeyword", ".", "VOLATILE_KEYWORD", ")", ")", ";", "}", "return", "result", ";", "}", "public", "Name", "newName", "(", "String", "qualifiedName", ")", "{", "StringTokenizer", "t", "=", "new", "StringTokenizer", "(", "qualifiedName", ",", "\".\"", ",", "true", ")", ";", "Name", "result", "=", "null", ";", "int", "balance", "=", "0", ";", "while", "(", "t", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "s", "=", "t", ".", "nextToken", "(", ")", ";", "if", "(", "s", ".", "indexOf", "(", "'.'", ")", ">=", "0", ")", "{", "if", "(", "s", ".", "length", "(", ")", ">", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "balance", "--", ";", "if", "(", "balance", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "else", "{", "balance", "++", ";", "SimpleName", "name", "=", "newSimpleName", "(", "s", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "name", ";", "}", "else", "{", "result", "=", "newQualifiedName", "(", "result", ",", "name", ")", ";", "}", "}", "}", "if", "(", "balance", "!=", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "result", ";", "}", "public", "Name", "newName", "(", "String", "[", "]", "identifiers", ")", "{", "int", "count", "=", "identifiers", ".", "length", ";", "if", "(", "count", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "Name", "result", "=", "newSimpleName", "(", "identifiers", "[", "0", "]", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "count", ";", "i", "++", ")", "{", "SimpleName", "name", "=", "newSimpleName", "(", "identifiers", "[", "i", "]", ")", ";", "result", "=", "newQualifiedName", "(", "result", ",", "name", ")", ";", "}", "return", "result", ";", "}", "public", "NormalAnnotation", "newNormalAnnotation", "(", ")", "{", "NormalAnnotation", "result", "=", "new", "NormalAnnotation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "NullLiteral", "newNullLiteral", "(", ")", "{", "return", "new", "NullLiteral", "(", "this", ")", ";", "}", "public", "NumberLiteral", "newNumberLiteral", "(", ")", "{", "NumberLiteral", "result", "=", "new", "NumberLiteral", "(", "this", ")", ";", "return", "result", ";", "}", "public", "NumberLiteral", "newNumberLiteral", "(", "String", "literal", ")", "{", "if", "(", "literal", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "NumberLiteral", "result", "=", "new", "NumberLiteral", "(", "this", ")", ";", "result", ".", "setToken", "(", "literal", ")", ";", "return", "result", ";", "}", "public", "PackageDeclaration", "newPackageDeclaration", "(", ")", "{", "PackageDeclaration", "result", "=", "new", "PackageDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ParameterizedType", "newParameterizedType", "(", "Type", "type", ")", "{", "ParameterizedType", "result", "=", "new", "ParameterizedType", "(", "this", ")", ";", "result", ".", "setType", "(", "type", ")", ";", "return", "result", ";", "}", "public", "ParenthesizedExpression", "newParenthesizedExpression", "(", ")", "{", "ParenthesizedExpression", "result", "=", "new", "ParenthesizedExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "PostfixExpression", "newPostfixExpression", "(", ")", "{", "PostfixExpression", "result", "=", "new", "PostfixExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "PrefixExpression", "newPrefixExpression", "(", ")", "{", "PrefixExpression", "result", "=", "new", "PrefixExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "PrimitiveType", "newPrimitiveType", "(", "PrimitiveType", ".", "Code", "typeCode", ")", "{", "PrimitiveType", "result", "=", "new", "PrimitiveType", "(", "this", ")", ";", "result", ".", "setPrimitiveTypeCode", "(", "typeCode", ")", ";", "return", "result", ";", "}", "public", "QualifiedName", "newQualifiedName", "(", "Name", "qualifier", ",", "SimpleName", "name", ")", "{", "QualifiedName", "result", "=", "new", "QualifiedName", "(", "this", ")", ";", "result", ".", "setQualifier", "(", "qualifier", ")", ";", "result", ".", "setName", "(", "name", ")", ";", "return", "result", ";", "}", "public", "QualifiedType", "newQualifiedType", "(", "Type", "qualifier", ",", "SimpleName", "name", ")", "{", "QualifiedType", "result", "=", "new", "QualifiedType", "(", "this", ")", ";", "result", ".", "setQualifier", "(", "qualifier", ")", ";", "result", ".", "setName", "(", "name", ")", ";", "return", "result", ";", "}", "public", "ReturnStatement", "newReturnStatement", "(", ")", "{", "return", "new", "ReturnStatement", "(", "this", ")", ";", "}", "public", "SimpleName", "newSimpleName", "(", "String", "identifier", ")", "{", "if", "(", "identifier", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "SimpleName", "result", "=", "new", "SimpleName", "(", "this", ")", ";", "result", ".", "setIdentifier", "(", "identifier", ")", ";", "return", "result", ";", "}", "public", "SimpleType", "newSimpleType", "(", "Name", "typeName", ")", "{", "SimpleType", "result", "=", "new", "SimpleType", "(", "this", ")", ";", "result", ".", "setName", "(", "typeName", ")", ";", "return", "result", ";", "}", "public", "SingleMemberAnnotation", "newSingleMemberAnnotation", "(", ")", "{", "SingleMemberAnnotation", "result", "=", "new", "SingleMemberAnnotation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "SingleVariableDeclaration", "newSingleVariableDeclaration", "(", ")", "{", "SingleVariableDeclaration", "result", "=", "new", "SingleVariableDeclaration", "(", "this", ")", ";", "return", "result", ";", "}", "public", "StringLiteral", "newStringLiteral", "(", ")", "{", "return", "new", "StringLiteral", "(", "this", ")", ";", "}", "public", "SuperConstructorInvocation", "newSuperConstructorInvocation", "(", ")", "{", "SuperConstructorInvocation", "result", "=", "new", "SuperConstructorInvocation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "SuperFieldAccess", "newSuperFieldAccess", "(", ")", "{", "SuperFieldAccess", "result", "=", "new", "SuperFieldAccess", "(", "this", ")", ";", "return", "result", ";", "}", "public", "SuperMethodInvocation", "newSuperMethodInvocation", "(", ")", "{", "SuperMethodInvocation", "result", "=", "new", "SuperMethodInvocation", "(", "this", ")", ";", "return", "result", ";", "}", "public", "SwitchCase", "newSwitchCase", "(", ")", "{", "return", "new", "SwitchCase", "(", "this", ")", ";", "}", "public", "SwitchStatement", "newSwitchStatement", "(", ")", "{", "return", "new", "SwitchStatement", "(", "this", ")", ";", "}", "public", "SynchronizedStatement", "newSynchronizedStatement", "(", ")", "{", "return", "new", "SynchronizedStatement", "(", "this", ")", ";", "}", "public", "TagElement", "newTagElement", "(", ")", "{", "TagElement", "result", "=", "new", "TagElement", "(", "this", ")", ";", "return", "result", ";", "}", "public", "TextElement", "newTextElement", "(", ")", "{", "TextElement", "result", "=", "new", "TextElement", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ThisExpression", "newThisExpression", "(", ")", "{", "ThisExpression", "result", "=", "new", "ThisExpression", "(", "this", ")", ";", "return", "result", ";", "}", "public", "ThrowStatement", "newThrowStatement", "(", ")", "{", "return", "new", "ThrowStatement", "(", "this", ")", ";", "}", "public", "TryStatement", "newTryStatement", "(", ")", "{", "return", "new", "TryStatement", "(", "this", ")", ";", "}", "public", "TypeDeclaration", "newTypeDeclaration", "(", ")", "{", "TypeDeclaration", "result", "=", "new", "TypeDeclaration", "(", "this", ")", ";", "result", ".", "setInterface", "(", "false", ")", ";", "return", "result", ";", "}", "public", "TypeDeclarationStatement", "newTypeDeclarationStatement", "(", "AbstractTypeDeclaration", "decl", ")", "{", "TypeDeclarationStatement", "result", "=", "new", "TypeDeclarationStatement", "(", "this", ")", ";", "if", "(", "this", ".", "apiLevel", "==", "AST", ".", "JLS2", ")", "{", "result", ".", "internalSetTypeDeclaration", "(", "(", "TypeDeclaration", ")", "decl", ")", ";", "}", "if", "(", "this", ".", "apiLevel", ">=", "AST", ".", "JLS3", ")", "{", "result", ".", "setDeclaration", "(", "decl", ")", ";", "}", "return", "result", ";", "}", "public", "TypeDeclarationStatement", "newTypeDeclarationStatement", "(", "TypeDeclaration", "decl", ")", "{", "TypeDeclarationStatement", "result", "=", "new", "TypeDeclarationStatement", "(", "this", ")", ";", "result", ".", "setDeclaration", "(", "decl", ")", ";", "return", "result", ";", "}", "public", "TypeLiteral", "newTypeLiteral", "(", ")", "{", "TypeLiteral", "result", "=", "new", "TypeLiteral", "(", "this", ")", ";", "return", "result", ";", "}", "public", "TypeParameter", "newTypeParameter", "(", ")", "{", "TypeParameter", "result", "=", "new", "TypeParameter", "(", "this", ")", ";", "return", "result", ";", "}", "public", "VariableDeclarationExpression", "newVariableDeclarationExpression", "(", "VariableDeclarationFragment", "fragment", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "VariableDeclarationExpression", "result", "=", "new", "VariableDeclarationExpression", "(", "this", ")", ";", "result", ".", "fragments", "(", ")", ".", "add", "(", "fragment", ")", ";", "return", "result", ";", "}", "public", "VariableDeclarationFragment", "newVariableDeclarationFragment", "(", ")", "{", "VariableDeclarationFragment", "result", "=", "new", "VariableDeclarationFragment", "(", "this", ")", ";", "return", "result", ";", "}", "public", "VariableDeclarationStatement", "newVariableDeclarationStatement", "(", "VariableDeclarationFragment", "fragment", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "VariableDeclarationStatement", "result", "=", "new", "VariableDeclarationStatement", "(", "this", ")", ";", "result", ".", "fragments", "(", ")", ".", "add", "(", "fragment", ")", ";", "return", "result", ";", "}", "public", "WhileStatement", "newWhileStatement", "(", ")", "{", "return", "new", "WhileStatement", "(", "this", ")", ";", "}", "public", "WildcardType", "newWildcardType", "(", ")", "{", "WildcardType", "result", "=", "new", "WildcardType", "(", "this", ")", ";", "return", "result", ";", "}", "void", "postAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "postAddChildEvent", "(", "node", ",", "child", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "postCloneNodeEvent", "(", "ASTNode", "node", ",", "ASTNode", "clone", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "postCloneNodeEvent", "(", "node", ",", "clone", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "postRemoveChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "postRemoveChildEvent", "(", "node", ",", "child", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "postReplaceChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "ASTNode", "newChild", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "postReplaceChildEvent", "(", "node", ",", "child", ",", "newChild", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "postValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "postValueChangeEvent", "(", "node", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "preAddChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "preAddChildEvent", "(", "node", ",", "child", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "preCloneNodeEvent", "(", "ASTNode", "node", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "preCloneNodeEvent", "(", "node", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "preRemoveChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "preRemoveChildEvent", "(", "node", ",", "child", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "preReplaceChildEvent", "(", "ASTNode", "node", ",", "ASTNode", "child", ",", "ASTNode", "newChild", ",", "StructuralPropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "preReplaceChildEvent", "(", "node", ",", "child", ",", "newChild", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "preValueChangeEvent", "(", "ASTNode", "node", ",", "SimplePropertyDescriptor", "property", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "if", "(", "this", ".", "disableEvents", ">", "0", ")", "{", "return", ";", "}", "else", "{", "disableEvents", "(", ")", ";", "}", "}", "try", "{", "this", ".", "eventHandler", ".", "preValueChangeEvent", "(", "node", ",", "property", ")", ";", "}", "finally", "{", "reenableEvents", "(", ")", ";", "}", "}", "void", "recordModifications", "(", "CompilationUnit", "root", ")", "{", "if", "(", "this", ".", "modificationCount", "!=", "this", ".", "originalModificationCount", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "else", "if", "(", "this", ".", "rewriter", "!=", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "else", "if", "(", "(", "root", ".", "getFlags", "(", ")", "&", "ASTNode", ".", "PROTECT", ")", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "else", "if", "(", "root", ".", "getAST", "(", ")", "!=", "this", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "this", ".", "rewriter", "=", "new", "InternalASTRewrite", "(", "root", ")", ";", "setEventHandler", "(", "this", ".", "rewriter", ")", ";", "}", "final", "void", "reenableEvents", "(", ")", "{", "synchronized", "(", "this", ".", "internalASTLock", ")", "{", "this", ".", "disableEvents", "--", ";", "}", "}", "public", "ITypeBinding", "resolveWellKnownType", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "return", "getBindingResolver", "(", ")", ".", "resolveWellKnownType", "(", "name", ")", ";", "}", "TextEdit", "rewrite", "(", "IDocument", "document", ",", "Map", "options", ")", "{", "if", "(", "document", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "rewriter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "return", "this", ".", "rewriter", ".", "rewriteAST", "(", "document", ",", "options", ")", ";", "}", "void", "setBindingResolver", "(", "BindingResolver", "resolver", ")", "{", "if", "(", "resolver", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "resolver", "=", "resolver", ";", "}", "void", "setDefaultNodeFlag", "(", "int", "flag", ")", "{", "this", ".", "defaultNodeFlag", "=", "flag", ";", "}", "void", "setEventHandler", "(", "NodeEventHandler", "eventHandler", ")", "{", "if", "(", "this", ".", "eventHandler", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "eventHandler", "=", "eventHandler", ";", "}", "void", "setFlag", "(", "int", "newValue", ")", "{", "this", ".", "bits", "|=", "newValue", ";", "}", "void", "setOriginalModificationCount", "(", "long", "count", ")", "{", "this", ".", "originalModificationCount", "=", "count", ";", "}", "void", "supportedOnlyIn2", "(", ")", "{", "if", "(", "this", ".", "apiLevel", "!=", "AST", ".", "JLS2", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"\"", ")", ";", "}", "}", "void", "unsupportedIn2", "(", ")", "{", "if", "(", "this", ".", "apiLevel", "==", "AST", ".", "JLS2", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"\"", ")", ";", "}", "}", "}", "</s>" ]
2,396
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "ReturnStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "ReturnStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "propertyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "ReturnStatement", ".", "class", ",", "propertyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "propertyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "propertyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "optionalExpression", "=", "null", ";", "ReturnStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "RETURN_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "ReturnStatement", "result", "=", "new", "ReturnStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getExpression", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "return", "this", ".", "optionalExpression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalExpression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "optionalExpression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "1", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "optionalExpression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]
2,397
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "AnonymousClassDeclaration", "extends", "ASTNode", "{", "public", "static", "final", "ChildListPropertyDescriptor", "BODY_DECLARATIONS_PROPERTY", "=", "new", "ChildListPropertyDescriptor", "(", "AnonymousClassDeclaration", ".", "class", ",", "\"\"", ",", "BodyDeclaration", ".", "class", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "2", ")", ";", "createPropertyList", "(", "AnonymousClassDeclaration", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "BODY_DECLARATIONS_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "ASTNode", ".", "NodeList", "bodyDeclarations", "=", "new", "ASTNode", ".", "NodeList", "(", "BODY_DECLARATIONS_PROPERTY", ")", ";", "AnonymousClassDeclaration", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "List", "internalGetChildListProperty", "(", "ChildListPropertyDescriptor", "property", ")", "{", "if", "(", "property", "==", "BODY_DECLARATIONS_PROPERTY", ")", "{", "return", "bodyDeclarations", "(", ")", ";", "}", "return", "super", ".", "internalGetChildListProperty", "(", "property", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "ANONYMOUS_CLASS_DECLARATION", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "AnonymousClassDeclaration", "result", "=", "new", "AnonymousClassDeclaration", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "bodyDeclarations", "(", ")", ".", "addAll", "(", "ASTNode", ".", "copySubtrees", "(", "target", ",", "bodyDeclarations", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChildren", "(", "visitor", ",", "this", ".", "bodyDeclarations", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "List", "bodyDeclarations", "(", ")", "{", "return", "this", ".", "bodyDeclarations", ";", "}", "public", "ITypeBinding", "resolveBinding", "(", ")", "{", "return", "this", ".", "ast", ".", "getBindingResolver", "(", ")", ".", "resolveType", "(", "this", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "BASE_NODE_SIZE", "+", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "this", ".", "bodyDeclarations", ".", "listSize", "(", ")", ";", "}", "}", "</s>" ]
2,398
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotatable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ElementValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "*", ";", "class", "AnnotationBinding", "implements", "IAnnotationBinding", "{", "static", "final", "AnnotationBinding", "[", "]", "NoAnnotations", "=", "new", "AnnotationBinding", "[", "0", "]", ";", "private", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "binding", ";", "private", "BindingResolver", "bindingResolver", ";", "private", "String", "key", ";", "AnnotationBinding", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "AnnotationBinding", "annotation", ",", "BindingResolver", "resolver", ")", "{", "if", "(", "annotation", "==", "null", ")", "throw", "new", "IllegalStateException", "(", ")", ";", "this", ".", "binding", "=", "annotation", ";", "this", ".", "bindingResolver", "=", "resolver", ";", "}", "public", "IAnnotationBinding", "[", "]", "getAnnotations", "(", ")", "{", "return", "NoAnnotations", ";", "}", "public", "ITypeBinding", "getAnnotationType", "(", ")", "{", "ITypeBinding", "typeBinding", "=", "this", ".", "bindingResolver", ".", "getTypeBinding", "(", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "return", "null", ";", "return", "typeBinding", ";", "}", "public", "IMemberValuePairBinding", "[", "]", "getDeclaredMemberValuePairs", "(", ")", "{", "ReferenceBinding", "typeBinding", "=", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ";", "if", "(", "typeBinding", "==", "null", "||", "(", "(", "typeBinding", ".", "tagBits", "&", "TagBits", ".", "HasMissingType", ")", "!=", "0", ")", ")", "{", "return", "MemberValuePairBinding", ".", "NoPair", ";", "}", "ElementValuePair", "[", "]", "internalPairs", "=", "this", ".", "binding", ".", "getElementValuePairs", "(", ")", ";", "int", "length", "=", "internalPairs", ".", "length", ";", "IMemberValuePairBinding", "[", "]", "pairs", "=", "length", "==", "0", "?", "MemberValuePairBinding", ".", "NoPair", ":", "new", "MemberValuePairBinding", "[", "length", "]", ";", "int", "counter", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ElementValuePair", "valuePair", "=", "internalPairs", "[", "i", "]", ";", "if", "(", "valuePair", ".", "binding", "==", "null", ")", "continue", ";", "pairs", "[", "counter", "++", "]", "=", "this", ".", "bindingResolver", ".", "getMemberValuePairBinding", "(", "valuePair", ")", ";", "}", "if", "(", "counter", "==", "0", ")", "return", "MemberValuePairBinding", ".", "NoPair", ";", "if", "(", "counter", "!=", "length", ")", "{", "System", ".", "arraycopy", "(", "pairs", ",", "0", ",", "(", "pairs", "=", "new", "MemberValuePairBinding", "[", "counter", "]", ")", ",", "0", ",", "counter", ")", ";", "}", "return", "pairs", ";", "}", "public", "IMemberValuePairBinding", "[", "]", "getAllMemberValuePairs", "(", ")", "{", "IMemberValuePairBinding", "[", "]", "pairs", "=", "getDeclaredMemberValuePairs", "(", ")", ";", "ReferenceBinding", "typeBinding", "=", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ";", "if", "(", "typeBinding", "==", "null", "||", "(", "(", "typeBinding", ".", "tagBits", "&", "TagBits", ".", "HasMissingType", ")", "!=", "0", ")", ")", "return", "pairs", ";", "MethodBinding", "[", "]", "methods", "=", "typeBinding", ".", "availableMethods", "(", ")", ";", "int", "methodLength", "=", "methods", "==", "null", "?", "0", ":", "methods", ".", "length", ";", "if", "(", "methodLength", "==", "0", ")", "return", "pairs", ";", "int", "declaredLength", "=", "pairs", ".", "length", ";", "if", "(", "declaredLength", "==", "methodLength", ")", "return", "pairs", ";", "HashtableOfObject", "table", "=", "new", "HashtableOfObject", "(", "declaredLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "declaredLength", ";", "i", "++", ")", "{", "char", "[", "]", "internalName", "=", "(", "(", "MemberValuePairBinding", ")", "pairs", "[", "i", "]", ")", ".", "internalName", "(", ")", ";", "if", "(", "internalName", "==", "null", ")", "continue", ";", "table", ".", "put", "(", "internalName", ",", "pairs", "[", "i", "]", ")", ";", "}", "IMemberValuePairBinding", "[", "]", "allPairs", "=", "new", "IMemberValuePairBinding", "[", "methodLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methodLength", ";", "i", "++", ")", "{", "Object", "pair", "=", "table", ".", "get", "(", "methods", "[", "i", "]", ".", "selector", ")", ";", "allPairs", "[", "i", "]", "=", "pair", "==", "null", "?", "new", "DefaultValuePairBinding", "(", "methods", "[", "i", "]", ",", "this", ".", "bindingResolver", ")", ":", "(", "IMemberValuePairBinding", ")", "pair", ";", "}", "return", "allPairs", ";", "}", "public", "IJavaElement", "getJavaElement", "(", ")", "{", "if", "(", "!", "(", "this", ".", "bindingResolver", "instanceof", "DefaultBindingResolver", ")", ")", "return", "null", ";", "ASTNode", "node", "=", "(", "ASTNode", ")", "(", "(", "DefaultBindingResolver", ")", "this", ".", "bindingResolver", ")", ".", "bindingsToAstNodes", ".", "get", "(", "this", ")", ";", "if", "(", "!", "(", "node", "instanceof", "Annotation", ")", ")", "return", "null", ";", "ASTNode", "parent", "=", "node", ".", "getParent", "(", ")", ";", "IJavaElement", "parentElement", "=", "null", ";", "switch", "(", "parent", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "PACKAGE_DECLARATION", ":", "IJavaElement", "cu", "=", "(", "(", "CompilationUnit", ")", "parent", ".", "getParent", "(", ")", ")", ".", "getJavaElement", "(", ")", ";", "if", "(", "cu", "instanceof", "ICompilationUnit", ")", "{", "String", "pkgName", "=", "(", "(", "PackageDeclaration", ")", "parent", ")", ".", "getName", "(", ")", ".", "getFullyQualifiedName", "(", ")", ";", "parentElement", "=", "(", "(", "ICompilationUnit", ")", "cu", ")", ".", "getPackageDeclaration", "(", "pkgName", ")", ";", "}", "break", ";", "case", "ASTNode", ".", "ENUM_DECLARATION", ":", "case", "ASTNode", ".", "TYPE_DECLARATION", ":", "case", "ASTNode", ".", "ANNOTATION_TYPE_DECLARATION", ":", "parentElement", "=", "(", "(", "AbstractTypeDeclaration", ")", "parent", ")", ".", "resolveBinding", "(", ")", ".", "getJavaElement", "(", ")", ";", "break", ";", "case", "ASTNode", ".", "FIELD_DECLARATION", ":", "VariableDeclarationFragment", "fragment", "=", "(", "VariableDeclarationFragment", ")", "(", "(", "FieldDeclaration", ")", "parent", ")", ".", "fragments", "(", ")", ".", "get", "(", "0", ")", ";", "IVariableBinding", "variableBinding", "=", "fragment", ".", "resolveBinding", "(", ")", ";", "if", "(", "variableBinding", "==", "null", ")", "{", "return", "null", ";", "}", "parentElement", "=", "variableBinding", ".", "getJavaElement", "(", ")", ";", "break", ";", "case", "ASTNode", ".", "METHOD_DECLARATION", ":", "IMethodBinding", "methodBinding", "=", "(", "(", "MethodDeclaration", ")", "parent", ")", ".", "resolveBinding", "(", ")", ";", "if", "(", "methodBinding", "==", "null", ")", "return", "null", ";", "parentElement", "=", "methodBinding", ".", "getJavaElement", "(", ")", ";", "break", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_STATEMENT", ":", "fragment", "=", "(", "VariableDeclarationFragment", ")", "(", "(", "VariableDeclarationStatement", ")", "parent", ")", ".", "fragments", "(", ")", ".", "get", "(", "0", ")", ";", "variableBinding", "=", "fragment", ".", "resolveBinding", "(", ")", ";", "if", "(", "variableBinding", "==", "null", ")", "{", "return", "null", ";", "}", "parentElement", "=", "variableBinding", ".", "getJavaElement", "(", ")", ";", "break", ";", "default", ":", "return", "null", ";", "}", "if", "(", "!", "(", "parentElement", "instanceof", "IAnnotatable", ")", ")", "return", "null", ";", "if", "(", "(", "parentElement", "instanceof", "IMember", ")", "&&", "(", "(", "IMember", ")", "parentElement", ")", ".", "isBinary", "(", ")", ")", "{", "return", "(", "(", "IAnnotatable", ")", "parentElement", ")", ".", "getAnnotation", "(", "getAnnotationType", "(", ")", ".", "getQualifiedName", "(", ")", ")", ";", "}", "return", "(", "(", "IAnnotatable", ")", "parentElement", ")", ".", "getAnnotation", "(", "getName", "(", ")", ")", ";", "}", "public", "String", "getKey", "(", ")", "{", "if", "(", "this", ".", "key", "==", "null", ")", "{", "String", "recipientKey", "=", "getRecipientKey", "(", ")", ";", "this", ".", "key", "=", "new", "String", "(", "this", ".", "binding", ".", "computeUniqueKey", "(", "recipientKey", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "return", "this", ".", "key", ";", "}", "private", "String", "getRecipientKey", "(", ")", "{", "if", "(", "!", "(", "this", ".", "bindingResolver", "instanceof", "DefaultBindingResolver", ")", ")", "return", "\"\"", ";", "DefaultBindingResolver", "resolver", "=", "(", "DefaultBindingResolver", ")", "this", ".", "bindingResolver", ";", "ASTNode", "node", "=", "(", "ASTNode", ")", "resolver", ".", "bindingsToAstNodes", ".", "get", "(", "this", ")", ";", "if", "(", "node", "==", "null", ")", "{", "return", "\"\"", ";", "}", "ASTNode", "recipient", "=", "node", ".", "getParent", "(", ")", ";", "switch", "(", "recipient", ".", "getNodeType", "(", ")", ")", "{", "case", "ASTNode", ".", "PACKAGE_DECLARATION", ":", "String", "pkgName", "=", "(", "(", "PackageDeclaration", ")", "recipient", ")", ".", "getName", "(", ")", ".", "getFullyQualifiedName", "(", ")", ";", "return", "pkgName", ".", "replace", "(", "'.'", ",", "'/'", ")", ";", "case", "ASTNode", ".", "TYPE_DECLARATION", ":", "return", "(", "(", "TypeDeclaration", ")", "recipient", ")", ".", "resolveBinding", "(", ")", ".", "getKey", "(", ")", ";", "case", "ASTNode", ".", "FIELD_DECLARATION", ":", "VariableDeclarationFragment", "fragment", "=", "(", "VariableDeclarationFragment", ")", "(", "(", "FieldDeclaration", ")", "recipient", ")", ".", "fragments", "(", ")", ".", "get", "(", "0", ")", ";", "return", "fragment", ".", "resolveBinding", "(", ")", ".", "getKey", "(", ")", ";", "case", "ASTNode", ".", "METHOD_DECLARATION", ":", "return", "(", "(", "MethodDeclaration", ")", "recipient", ")", ".", "resolveBinding", "(", ")", ".", "getKey", "(", ")", ";", "case", "ASTNode", ".", "VARIABLE_DECLARATION_STATEMENT", ":", "fragment", "=", "(", "VariableDeclarationFragment", ")", "(", "(", "VariableDeclarationStatement", ")", "recipient", ")", ".", "fragments", "(", ")", ".", "get", "(", "0", ")", ";", "return", "fragment", ".", "resolveBinding", "(", ")", ".", "getKey", "(", ")", ";", "default", ":", "return", "\"\"", ";", "}", "}", "public", "int", "getKind", "(", ")", "{", "return", "IBinding", ".", "ANNOTATION", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "Modifier", ".", "NONE", ";", "}", "public", "String", "getName", "(", ")", "{", "ITypeBinding", "annotationType", "=", "getAnnotationType", "(", ")", ";", "if", "(", "annotationType", "==", "null", ")", "{", "return", "new", "String", "(", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ".", "sourceName", "(", ")", ")", ";", "}", "else", "{", "return", "annotationType", ".", "getName", "(", ")", ";", "}", "}", "public", "boolean", "isDeprecated", "(", ")", "{", "ReferenceBinding", "typeBinding", "=", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ";", "if", "(", "typeBinding", "==", "null", ")", "return", "false", ";", "return", "typeBinding", ".", "isDeprecated", "(", ")", ";", "}", "public", "boolean", "isEqualTo", "(", "IBinding", "otherBinding", ")", "{", "if", "(", "this", "==", "otherBinding", ")", "return", "true", ";", "if", "(", "otherBinding", ".", "getKind", "(", ")", "!=", "IBinding", ".", "ANNOTATION", ")", "return", "false", ";", "IAnnotationBinding", "other", "=", "(", "IAnnotationBinding", ")", "otherBinding", ";", "if", "(", "!", "getAnnotationType", "(", ")", ".", "isEqualTo", "(", "other", ".", "getAnnotationType", "(", ")", ")", ")", "return", "false", ";", "IMemberValuePairBinding", "[", "]", "memberValuePairs", "=", "getDeclaredMemberValuePairs", "(", ")", ";", "IMemberValuePairBinding", "[", "]", "otherMemberValuePairs", "=", "other", ".", "getDeclaredMemberValuePairs", "(", ")", ";", "if", "(", "memberValuePairs", ".", "length", "!=", "otherMemberValuePairs", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "memberValuePairs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "memberValuePairs", "[", "i", "]", ".", "isEqualTo", "(", "otherMemberValuePairs", "[", "i", "]", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "isRecovered", "(", ")", "{", "ReferenceBinding", "annotationType", "=", "this", ".", "binding", ".", "getAnnotationType", "(", ")", ";", "return", "annotationType", "==", "null", "||", "(", "annotationType", ".", "tagBits", "&", "TagBits", ".", "HasMissingType", ")", "!=", "0", ";", "}", "public", "boolean", "isSynthetic", "(", ")", "{", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "ITypeBinding", "type", "=", "getAnnotationType", "(", ")", ";", "final", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "'@'", ")", ";", "if", "(", "type", "!=", "null", ")", "buffer", ".", "append", "(", "type", ".", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'('", ")", ";", "IMemberValuePairBinding", "[", "]", "pairs", "=", "getDeclaredMemberValuePairs", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "pairs", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "buffer", ".", "append", "(", "pairs", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "')'", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,399
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "IfStatement", "extends", "Statement", "{", "public", "static", "final", "ChildPropertyDescriptor", "EXPRESSION_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "IfStatement", ".", "class", ",", "\"expression\"", ",", "Expression", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "THEN_STATEMENT_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "IfStatement", ".", "class", ",", "\"\"", ",", "Statement", ".", "class", ",", "MANDATORY", ",", "CYCLE_RISK", ")", ";", "public", "static", "final", "ChildPropertyDescriptor", "ELSE_STATEMENT_PROPERTY", "=", "new", "ChildPropertyDescriptor", "(", "IfStatement", ".", "class", ",", "\"\"", ",", "Statement", ".", "class", ",", "OPTIONAL", ",", "CYCLE_RISK", ")", ";", "private", "static", "final", "List", "PROPERTY_DESCRIPTORS", ";", "static", "{", "List", "properyList", "=", "new", "ArrayList", "(", "4", ")", ";", "createPropertyList", "(", "IfStatement", ".", "class", ",", "properyList", ")", ";", "addProperty", "(", "EXPRESSION_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "THEN_STATEMENT_PROPERTY", ",", "properyList", ")", ";", "addProperty", "(", "ELSE_STATEMENT_PROPERTY", ",", "properyList", ")", ";", "PROPERTY_DESCRIPTORS", "=", "reapPropertyList", "(", "properyList", ")", ";", "}", "public", "static", "List", "propertyDescriptors", "(", "int", "apiLevel", ")", "{", "return", "PROPERTY_DESCRIPTORS", ";", "}", "private", "Expression", "expression", "=", "null", ";", "private", "Statement", "thenStatement", "=", "null", ";", "private", "Statement", "optionalElseStatement", "=", "null", ";", "IfStatement", "(", "AST", "ast", ")", "{", "super", "(", "ast", ")", ";", "}", "final", "List", "internalStructuralPropertiesForType", "(", "int", "apiLevel", ")", "{", "return", "propertyDescriptors", "(", "apiLevel", ")", ";", "}", "final", "ASTNode", "internalGetSetChildProperty", "(", "ChildPropertyDescriptor", "property", ",", "boolean", "get", ",", "ASTNode", "child", ")", "{", "if", "(", "property", "==", "EXPRESSION_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getExpression", "(", ")", ";", "}", "else", "{", "setExpression", "(", "(", "Expression", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "THEN_STATEMENT_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getThenStatement", "(", ")", ";", "}", "else", "{", "setThenStatement", "(", "(", "Statement", ")", "child", ")", ";", "return", "null", ";", "}", "}", "if", "(", "property", "==", "ELSE_STATEMENT_PROPERTY", ")", "{", "if", "(", "get", ")", "{", "return", "getElseStatement", "(", ")", ";", "}", "else", "{", "setElseStatement", "(", "(", "Statement", ")", "child", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "internalGetSetChildProperty", "(", "property", ",", "get", ",", "child", ")", ";", "}", "final", "int", "getNodeType0", "(", ")", "{", "return", "IF_STATEMENT", ";", "}", "ASTNode", "clone0", "(", "AST", "target", ")", "{", "IfStatement", "result", "=", "new", "IfStatement", "(", "target", ")", ";", "result", ".", "setSourceRange", "(", "getStartPosition", "(", ")", ",", "getLength", "(", ")", ")", ";", "result", ".", "copyLeadingComment", "(", "this", ")", ";", "result", ".", "setExpression", "(", "(", "Expression", ")", "getExpression", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setThenStatement", "(", "(", "Statement", ")", "getThenStatement", "(", ")", ".", "clone", "(", "target", ")", ")", ";", "result", ".", "setElseStatement", "(", "(", "Statement", ")", "ASTNode", ".", "copySubtree", "(", "target", ",", "getElseStatement", "(", ")", ")", ")", ";", "return", "result", ";", "}", "final", "boolean", "subtreeMatch0", "(", "ASTMatcher", "matcher", ",", "Object", "other", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "other", ")", ";", "}", "void", "accept0", "(", "ASTVisitor", "visitor", ")", "{", "boolean", "visitChildren", "=", "visitor", ".", "visit", "(", "this", ")", ";", "if", "(", "visitChildren", ")", "{", "acceptChild", "(", "visitor", ",", "getExpression", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getThenStatement", "(", ")", ")", ";", "acceptChild", "(", "visitor", ",", "getElseStatement", "(", ")", ")", ";", "}", "visitor", ".", "endVisit", "(", "this", ")", ";", "}", "public", "Expression", "getExpression", "(", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "expression", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "expression", "=", "new", "SimpleName", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "expression", ";", "}", "public", "void", "setExpression", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "expression", ";", "preReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "this", ".", "expression", "=", "expression", ";", "postReplaceChild", "(", "oldChild", ",", "expression", ",", "EXPRESSION_PROPERTY", ")", ";", "}", "public", "Statement", "getThenStatement", "(", ")", "{", "if", "(", "this", ".", "thenStatement", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "thenStatement", "==", "null", ")", "{", "preLazyInit", "(", ")", ";", "this", ".", "thenStatement", "=", "new", "Block", "(", "this", ".", "ast", ")", ";", "postLazyInit", "(", "this", ".", "thenStatement", ",", "THEN_STATEMENT_PROPERTY", ")", ";", "}", "}", "}", "return", "this", ".", "thenStatement", ";", "}", "public", "void", "setThenStatement", "(", "Statement", "statement", ")", "{", "if", "(", "statement", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "ASTNode", "oldChild", "=", "this", ".", "thenStatement", ";", "preReplaceChild", "(", "oldChild", ",", "statement", ",", "THEN_STATEMENT_PROPERTY", ")", ";", "this", ".", "thenStatement", "=", "statement", ";", "postReplaceChild", "(", "oldChild", ",", "statement", ",", "THEN_STATEMENT_PROPERTY", ")", ";", "}", "public", "Statement", "getElseStatement", "(", ")", "{", "return", "this", ".", "optionalElseStatement", ";", "}", "public", "void", "setElseStatement", "(", "Statement", "statement", ")", "{", "ASTNode", "oldChild", "=", "this", ".", "optionalElseStatement", ";", "preReplaceChild", "(", "oldChild", ",", "statement", ",", "ELSE_STATEMENT_PROPERTY", ")", ";", "this", ".", "optionalElseStatement", "=", "statement", ";", "postReplaceChild", "(", "oldChild", ",", "statement", ",", "ELSE_STATEMENT_PROPERTY", ")", ";", "}", "int", "memSize", "(", ")", "{", "return", "super", ".", "memSize", "(", ")", "+", "3", "*", "4", ";", "}", "int", "treeSize", "(", ")", "{", "return", "memSize", "(", ")", "+", "(", "this", ".", "expression", "==", "null", "?", "0", ":", "getExpression", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "thenStatement", "==", "null", "?", "0", ":", "getThenStatement", "(", ")", ".", "treeSize", "(", ")", ")", "+", "(", "this", ".", "optionalElseStatement", "==", "null", "?", "0", ":", "getElseStatement", "(", ")", ".", "treeSize", "(", ")", ")", ";", "}", "}", "</s>" ]