├── .gitignore ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── source_to_parse └── com │ └── github │ └── javaparser │ ├── ASTHelper.java │ ├── JavaParser.java │ ├── Position.java │ ├── PositionUtils.java │ ├── SourcesHelper.java │ └── ast │ ├── AccessSpecifier.java │ ├── CompilationUnit.java │ ├── DocumentableNode.java │ ├── Example.java │ ├── ImportDeclaration.java │ ├── NamedNode.java │ ├── Node.java │ ├── PackageDeclaration.java │ ├── TreeVisitor.java │ ├── TypeArguments.java │ ├── TypeParameter.java │ ├── TypedNode.java │ ├── body │ ├── AnnotableNode.java │ ├── AnnotationDeclaration.java │ ├── AnnotationMemberDeclaration.java │ ├── BaseParameter.java │ ├── BodyDeclaration.java │ ├── ClassOrInterfaceDeclaration.java │ ├── ConstructorDeclaration.java │ ├── EmptyMemberDeclaration.java │ ├── EmptyTypeDeclaration.java │ ├── EnumConstantDeclaration.java │ ├── EnumDeclaration.java │ ├── FieldDeclaration.java │ ├── InitializerDeclaration.java │ ├── MethodDeclaration.java │ ├── ModifierSet.java │ ├── MultiTypeParameter.java │ ├── Parameter.java │ ├── TypeDeclaration.java │ ├── VariableDeclarator.java │ ├── VariableDeclaratorId.java │ └── WithDeclaration.java │ ├── comments │ ├── BlockComment.java │ ├── Comment.java │ ├── CommentsCollection.java │ ├── CommentsParser.java │ ├── JavadocComment.java │ └── LineComment.java │ ├── expr │ ├── AnnotationExpr.java │ ├── ArrayAccessExpr.java │ ├── ArrayCreationExpr.java │ ├── ArrayInitializerExpr.java │ ├── AssignExpr.java │ ├── BinaryExpr.java │ ├── BooleanLiteralExpr.java │ ├── CastExpr.java │ ├── CharLiteralExpr.java │ ├── ClassExpr.java │ ├── ConditionalExpr.java │ ├── DoubleLiteralExpr.java │ ├── EnclosedExpr.java │ ├── Expression.java │ ├── FieldAccessExpr.java │ ├── InstanceOfExpr.java │ ├── IntegerLiteralExpr.java │ ├── IntegerLiteralMinValueExpr.java │ ├── LambdaExpr.java │ ├── LiteralExpr.java │ ├── LongLiteralExpr.java │ ├── LongLiteralMinValueExpr.java │ ├── MarkerAnnotationExpr.java │ ├── MemberValuePair.java │ ├── MethodCallExpr.java │ ├── MethodReferenceExpr.java │ ├── NameExpr.java │ ├── NormalAnnotationExpr.java │ ├── NullLiteralExpr.java │ ├── ObjectCreationExpr.java │ ├── QualifiedNameExpr.java │ ├── SingleMemberAnnotationExpr.java │ ├── StringLiteralExpr.java │ ├── SuperExpr.java │ ├── ThisExpr.java │ ├── TypeExpr.java │ ├── UnaryExpr.java │ └── VariableDeclarationExpr.java │ ├── internal │ └── Utils.java │ ├── stmt │ ├── AssertStmt.java │ ├── BlockStmt.java │ ├── BreakStmt.java │ ├── CatchClause.java │ ├── ContinueStmt.java │ ├── DoStmt.java │ ├── EmptyStmt.java │ ├── ExplicitConstructorInvocationStmt.java │ ├── ExpressionStmt.java │ ├── ForStmt.java │ ├── ForeachStmt.java │ ├── IfStmt.java │ ├── LabeledStmt.java │ ├── ReturnStmt.java │ ├── Statement.java │ ├── SwitchEntryStmt.java │ ├── SwitchStmt.java │ ├── SynchronizedStmt.java │ ├── ThrowStmt.java │ ├── TryStmt.java │ ├── TypeDeclarationStmt.java │ └── WhileStmt.java │ ├── type │ ├── ClassOrInterfaceType.java │ ├── IntersectionType.java │ ├── PrimitiveType.java │ ├── ReferenceType.java │ ├── Type.java │ ├── UnionType.java │ ├── UnknownType.java │ ├── VoidType.java │ └── WildcardType.java │ └── visitor │ ├── CloneVisitor.java │ ├── DumpVisitor.java │ ├── EqualsVisitor.java │ ├── GenericVisitor.java │ ├── GenericVisitorAdapter.java │ ├── ModifierVisitorAdapter.java │ ├── VoidVisitor.java │ └── VoidVisitorAdapter.java └── src └── main └── java └── me └── tomassetti └── javadocextractor ├── AllJavadocExtractor.java ├── ClassesJavadocExtractor.java └── support ├── DirExplorer.java └── NodeIterator.java /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | out 3 | *.iml 4 | *.ipr 5 | *.iws 6 | .idea 7 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'idea' 3 | 4 | sourceCompatibility = 1.8 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | compile group: 'com.github.javaparser', name:'javaparser-core', version: '3.0.0' 12 | compile group: 'com.google.guava', name: 'guava', version: '11.0.2' 13 | testCompile group: 'junit', name: 'junit', version: '4.11' 14 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftomassetti/javadoc-extractor/5a339429f7ecff1b17206a7e0b8a9e2441552744/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 01 16:59:59 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This settings file was auto generated by the Gradle buildInit task 3 | * by 'federico' at '01/07/16 16:59' with Gradle 2.5 4 | * 5 | * The settings file is used to specify which projects to include in your build. 6 | * In a single project build this file can be empty or even removed. 7 | * 8 | * Detailed information about configuring a multi-project build in Gradle can be found 9 | * in the user guide at http://gradle.org/docs/2.5/userguide/multi_project_builds.html 10 | */ 11 | 12 | /* 13 | // To declare projects as part of a multi-project build use the 'include' method 14 | include 'shared' 15 | include 'api' 16 | include 'services:webservice' 17 | */ 18 | 19 | rootProject.name = 'javadoc-extractor' 20 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/Position.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser; 23 | 24 | import com.github.javaparser.ast.Node; 25 | 26 | public class Position { 27 | private int line; 28 | private int column; 29 | 30 | public static final Position ABSOLUTE_START = new Position(Node.ABSOLUTE_BEGIN_LINE,-1); 31 | public static final Position ABSOLUTE_END = new Position(Node.ABSOLUTE_END_LINE,-1); 32 | 33 | public static Position beginOf(Node node){ 34 | return new Position(node.getBeginLine(),node.getBeginColumn()); 35 | } 36 | 37 | public static Position endOf(Node node){ 38 | return new Position(node.getEndLine(),node.getEndColumn()); 39 | } 40 | 41 | public Position(int line, int column){ 42 | this.line = line; 43 | this.column = column; 44 | } 45 | 46 | public int getLine(){ 47 | return this.line; 48 | } 49 | 50 | public int getColumn(){ 51 | return this.column; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/SourcesHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser; 23 | 24 | import java.io.*; 25 | 26 | public class SourcesHelper { 27 | 28 | static String streamToString(InputStream in, String encoding){ 29 | if (encoding == null) { 30 | return streamToString(in); 31 | } else { 32 | java.util.Scanner s = new java.util.Scanner(in, encoding).useDelimiter("\\A"); 33 | return s.hasNext() ? s.next() : ""; 34 | } 35 | } 36 | 37 | static String streamToString(InputStream in){ 38 | java.util.Scanner s = new java.util.Scanner(in).useDelimiter("\\A"); 39 | return s.hasNext() ? s.next() : ""; 40 | } 41 | 42 | static InputStream stringToStream(String s, String encoding) throws UnsupportedEncodingException { 43 | byte[] rawData = encoding != null ? s.getBytes(encoding) : s.getBytes(); 44 | return new ByteArrayInputStream(rawData); 45 | } 46 | 47 | static String readerToString(Reader reader) throws IOException { 48 | char[] arr = new char[8*1024]; // 8K at a time 49 | StringBuilder buf = new StringBuilder(); 50 | int numChars; 51 | 52 | while ((numChars = reader.read(arr, 0, arr.length)) > 0) { 53 | buf.append(arr, 0, numChars); 54 | } 55 | 56 | return buf.toString(); 57 | } 58 | 59 | static Reader stringToReader(String s){ 60 | return new StringReader(s); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/AccessSpecifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast; 23 | 24 | /** 25 | * Access specifier. Represents one of the possible levels of 26 | * access permitted by the language. 27 | * 28 | * @author Federico Tomassetti 29 | * @since July 2014 30 | */ 31 | public enum AccessSpecifier { 32 | 33 | PUBLIC("public"), 34 | PRIVATE("private"), 35 | PROTECTED("protected"), 36 | DEFAULT(""); 37 | 38 | private String codeRepresenation; 39 | 40 | private AccessSpecifier(String codeRepresentation) { 41 | this.codeRepresenation = codeRepresentation; 42 | } 43 | 44 | public String getCodeRepresenation(){ 45 | return this.codeRepresenation; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/DocumentableNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast; 23 | 24 | import com.github.javaparser.ast.comments.JavadocComment; 25 | 26 | /** 27 | * Node which can be documented through a Javadoc comment. 28 | */ 29 | public interface DocumentableNode { 30 | 31 | public JavadocComment getJavaDoc(); 32 | public void setJavaDoc(JavadocComment javadocComment); 33 | } 34 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/Example.java: -------------------------------------------------------------------------------- 1 | package com.github.javaparser.ast; 2 | 3 | import com.github.javaparser.JavaParser; 4 | import com.github.javaparser.ParseException; 5 | import com.github.javaparser.ast.CompilationUnit; 6 | 7 | import java.io.ByteArrayInputStream; 8 | import java.io.InputStream; 9 | import java.io.UnsupportedEncodingException; 10 | 11 | /** 12 | * Created by federico on 07/01/16. 13 | */ 14 | public class Example { 15 | 16 | public static void main(String[] args) throws UnsupportedEncodingException, ParseException { 17 | String code = "interface A {\n" + 18 | " default Comparator thenComparing(Comparator other) {\n" + 19 | " Objects.requireNonNull(other);\n" + 20 | " return (Comparator & Serializable) (c1, c2) -> { // this is the defaulting line\n" + 21 | " int res = compare(c1, c2);\n" + 22 | " return (res != 0) ? res : other.compare(c1, c2);\n" + 23 | " };\n" + 24 | " }\n" + 25 | "}"; 26 | InputStream stream = new ByteArrayInputStream(code.getBytes("UTF-8")); 27 | CompilationUnit cu = JavaParser.parse(stream); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/NamedNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast; 23 | 24 | /** 25 | * A node having a name. 26 | * 27 | * The main reason for this interface is to permit users to manipulate homogeneously all nodes with a getName method. 28 | * 29 | * @since 2.0.1 30 | */ 31 | public interface NamedNode { 32 | String getName(); 33 | } 34 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/TreeVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast; 23 | 24 | public abstract class TreeVisitor { 25 | 26 | public void visitDepthFirst(Node node){ 27 | process(node); 28 | for (Node child : node.getChildrenNodes()){ 29 | visitDepthFirst(child); 30 | } 31 | } 32 | 33 | public abstract void process(Node node); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/TypeArguments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The JavaParser Team. 3 | * 4 | * This file is part of JavaParser. 5 | * 6 | * JavaParser can be used either under the terms of 7 | * a) the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * b) the terms of the Apache License 11 | * 12 | * You should have received a copy of both licenses in LICENCE.LGPL and 13 | * LICENCE.APACHE. Please refer to those files for details. 14 | * 15 | * JavaParser is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Lesser General Public License for more details. 19 | */ 20 | 21 | package com.github.javaparser.ast; 22 | 23 | import com.github.javaparser.ast.type.Type; 24 | 25 | import java.util.Collections; 26 | import java.util.List; 27 | 28 | import static com.github.javaparser.ast.internal.Utils.ensureNotNull; 29 | import static java.util.Collections.unmodifiableList; 30 | 31 | public class TypeArguments { 32 | public static final TypeArguments EMPTY = withArguments(Collections.emptyList()); 33 | 34 | private final List typeArguments; 35 | private final boolean usesDiamondOperator; 36 | 37 | private TypeArguments(List typeArguments, boolean usesDiamondOperator) { 38 | this.typeArguments = ensureNotNull(typeArguments); 39 | this.usesDiamondOperator = usesDiamondOperator; 40 | } 41 | 42 | public List getTypeArguments() { 43 | return unmodifiableList(typeArguments); 44 | } 45 | 46 | public boolean isUsingDiamondOperator() { 47 | return usesDiamondOperator; 48 | } 49 | 50 | public static TypeArguments withDiamondOperator() { 51 | return new TypeArguments(Collections.emptyList(), true); 52 | } 53 | 54 | public static TypeArguments withArguments(List typeArguments) { 55 | return new TypeArguments(typeArguments, false); 56 | } 57 | } -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/TypedNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast; 23 | 24 | import com.github.javaparser.ast.type.Type; 25 | 26 | /** 27 | * A node having a type. 28 | * 29 | * The main reason for this interface is to permit users to manipulate homogeneously all nodes with getType/setType 30 | * methods 31 | * 32 | * @since 2.3.1 33 | */ 34 | public interface TypedNode { 35 | Type getType(); 36 | 37 | void setType(Type type); 38 | } 39 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/AnnotableNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.expr.AnnotationExpr; 25 | 26 | import java.util.List; 27 | 28 | /** 29 | * An element which can be the target of annotations. 30 | * 31 | * @author Federico Tomassetti 32 | * @since July 2014 33 | */ 34 | public interface AnnotableNode { 35 | public List getAnnotations(); 36 | } 37 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/AnnotationDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.comments.JavadocComment; 25 | import com.github.javaparser.ast.expr.AnnotationExpr; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | import java.util.List; 30 | 31 | /** 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public final class AnnotationDeclaration extends TypeDeclaration { 35 | 36 | public AnnotationDeclaration() { 37 | } 38 | 39 | public AnnotationDeclaration(int modifiers, String name) { 40 | super(modifiers, name); 41 | } 42 | 43 | public AnnotationDeclaration(int modifiers, List annotations, String name, List members) { 44 | super(annotations, modifiers, name, members); 45 | } 46 | 47 | public AnnotationDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List annotations, String name, List members) { 48 | super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members); 49 | } 50 | 51 | @Override 52 | public R accept(GenericVisitor v, A arg) { 53 | return v.visit(this, arg); 54 | } 55 | 56 | @Override 57 | public void accept(VoidVisitor v, A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | @Override 62 | public void setJavaDoc(JavadocComment javadocComment) { 63 | this.javadocComment = javadocComment; 64 | } 65 | 66 | @Override 67 | public JavadocComment getJavaDoc() { 68 | return javadocComment; 69 | } 70 | 71 | private JavadocComment javadocComment; 72 | } 73 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/BaseParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.Node; 25 | import com.github.javaparser.ast.expr.AnnotationExpr; 26 | 27 | import java.util.List; 28 | 29 | import static com.github.javaparser.ast.internal.Utils.*; 30 | 31 | public abstract class BaseParameter extends Node implements AnnotableNode { 32 | private int modifiers; 33 | 34 | private List annotations; 35 | 36 | private VariableDeclaratorId id; 37 | 38 | public BaseParameter() { 39 | } 40 | 41 | public BaseParameter(VariableDeclaratorId id) { 42 | setId(id); 43 | } 44 | 45 | public BaseParameter(int modifiers, VariableDeclaratorId id) { 46 | setModifiers(modifiers); 47 | setId(id); 48 | } 49 | 50 | public BaseParameter(int modifiers, List annotations, VariableDeclaratorId id) { 51 | setModifiers(modifiers); 52 | setAnnotations(annotations); 53 | setId(id); 54 | } 55 | 56 | public BaseParameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List annotations, VariableDeclaratorId id) { 57 | super(beginLine, beginColumn, endLine, endColumn); 58 | setModifiers(modifiers); 59 | setAnnotations(annotations); 60 | setId(id); 61 | } 62 | 63 | /** 64 | * @return the list returned could be immutable (in that case it will be empty) 65 | */ 66 | public List getAnnotations() { 67 | annotations = ensureNotNull(annotations); 68 | return annotations; 69 | } 70 | 71 | public VariableDeclaratorId getId() { 72 | return id; 73 | } 74 | 75 | /** 76 | * Return the modifiers of this parameter declaration. 77 | * 78 | * @see ModifierSet 79 | * @return modifiers 80 | */ 81 | public int getModifiers() { 82 | return modifiers; 83 | } 84 | 85 | /** 86 | * @param annotations a null value is currently treated as an empty list. This behavior could change 87 | * in the future, so please avoid passing null 88 | */ 89 | public void setAnnotations(List annotations) { 90 | this.annotations = annotations; 91 | setAsParentNodeOf(this.annotations); 92 | } 93 | 94 | public void setId(VariableDeclaratorId id) { 95 | this.id = id; 96 | setAsParentNodeOf(this.id); 97 | } 98 | 99 | public void setModifiers(int modifiers) { 100 | this.modifiers = modifiers; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/BodyDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.Node; 25 | import com.github.javaparser.ast.expr.AnnotationExpr; 26 | import com.github.javaparser.ast.internal.Utils; 27 | 28 | import java.util.List; 29 | 30 | /** 31 | * @author Julio Vilmar Gesser 32 | */ 33 | public abstract class BodyDeclaration extends Node implements AnnotableNode { 34 | 35 | private List annotations; 36 | 37 | public BodyDeclaration() { 38 | } 39 | 40 | public BodyDeclaration(List annotations) { 41 | setAnnotations(annotations); 42 | } 43 | 44 | public BodyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List annotations) { 45 | super(beginLine, beginColumn, endLine, endColumn); 46 | setAnnotations(annotations); 47 | } 48 | 49 | @Override 50 | public final List getAnnotations() { 51 | annotations = Utils.ensureNotNull(annotations); 52 | return annotations; 53 | } 54 | 55 | /** 56 | * 57 | * @param annotations a null value is currently treated as an empty list. This behavior could change 58 | * in the future, so please avoid passing null 59 | */ 60 | public final void setAnnotations(List annotations) { 61 | this.annotations = annotations; 62 | setAsParentNodeOf(this.annotations); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/EmptyMemberDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.DocumentableNode; 25 | import com.github.javaparser.ast.comments.JavadocComment; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class EmptyMemberDeclaration extends BodyDeclaration implements DocumentableNode { 33 | 34 | public EmptyMemberDeclaration() { 35 | super(null); 36 | } 37 | 38 | public EmptyMemberDeclaration(int beginLine, int beginColumn, int endLine, int endColumn) { 39 | super(beginLine, beginColumn, endLine, endColumn, null); 40 | } 41 | 42 | @Override 43 | public R accept(GenericVisitor v, A arg) { 44 | return v.visit(this, arg); 45 | } 46 | 47 | @Override 48 | public void accept(VoidVisitor v, A arg) { 49 | v.visit(this, arg); 50 | } 51 | 52 | @Override 53 | public void setJavaDoc(JavadocComment javadocComment) { 54 | this.javadocComment = javadocComment; 55 | } 56 | 57 | @Override 58 | public JavadocComment getJavaDoc() { 59 | return javadocComment; 60 | } 61 | 62 | private JavadocComment javadocComment; 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/EmptyTypeDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.comments.JavadocComment; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class EmptyTypeDeclaration extends TypeDeclaration { 32 | 33 | public EmptyTypeDeclaration() { 34 | super(null, 0, null, null); 35 | } 36 | 37 | public EmptyTypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn) { 38 | super(beginLine, beginColumn, endLine, endColumn, null, 0, null, null); 39 | } 40 | 41 | @Override 42 | public R accept(GenericVisitor v, A arg) { 43 | return v.visit(this, arg); 44 | } 45 | 46 | @Override 47 | public void setJavaDoc(JavadocComment javadocComment) { 48 | //To change body of implemented methods use File | Settings | File Templates. 49 | } 50 | 51 | @Override 52 | public void accept(VoidVisitor v, A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | @Override 57 | public JavadocComment getJavaDoc() { 58 | return null; //To change body of implemented methods use File | Settings | File Templates. 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/InitializerDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.DocumentableNode; 25 | import com.github.javaparser.ast.comments.JavadocComment; 26 | import com.github.javaparser.ast.stmt.BlockStmt; 27 | import com.github.javaparser.ast.visitor.GenericVisitor; 28 | import com.github.javaparser.ast.visitor.VoidVisitor; 29 | 30 | /** 31 | * @author Julio Vilmar Gesser 32 | */ 33 | public final class InitializerDeclaration extends BodyDeclaration implements DocumentableNode { 34 | 35 | private boolean isStatic; 36 | 37 | private BlockStmt block; 38 | 39 | public InitializerDeclaration() { 40 | } 41 | 42 | public InitializerDeclaration(boolean isStatic, BlockStmt block) { 43 | super(null); 44 | setStatic(isStatic); 45 | setBlock(block); 46 | } 47 | 48 | public InitializerDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, boolean isStatic, BlockStmt block) { 49 | super(beginLine, beginColumn, endLine, endColumn, null); 50 | setStatic(isStatic); 51 | setBlock(block); 52 | } 53 | 54 | @Override 55 | public R accept(GenericVisitor v, A arg) { 56 | return v.visit(this, arg); 57 | } 58 | 59 | @Override 60 | public void accept(VoidVisitor v, A arg) { 61 | v.visit(this, arg); 62 | } 63 | 64 | public BlockStmt getBlock() { 65 | return block; 66 | } 67 | 68 | public boolean isStatic() { 69 | return isStatic; 70 | } 71 | 72 | public void setBlock(BlockStmt block) { 73 | this.block = block; 74 | setAsParentNodeOf(this.block); 75 | } 76 | 77 | public void setStatic(boolean isStatic) { 78 | this.isStatic = isStatic; 79 | } 80 | 81 | @Override 82 | public void setJavaDoc(JavadocComment javadocComment) { 83 | this.javadocComment = javadocComment; 84 | } 85 | 86 | @Override 87 | public JavadocComment getJavaDoc() { 88 | return javadocComment; 89 | } 90 | 91 | private JavadocComment javadocComment; 92 | } 93 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/MultiTypeParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.expr.AnnotationExpr; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.type.UnionType; 27 | import com.github.javaparser.ast.visitor.GenericVisitor; 28 | import com.github.javaparser.ast.visitor.VoidVisitor; 29 | 30 | import java.util.List; 31 | 32 | import static com.github.javaparser.ast.internal.Utils.ensureNotNull; 33 | 34 | public class MultiTypeParameter extends BaseParameter { 35 | private UnionType type; 36 | 37 | public MultiTypeParameter() {} 38 | 39 | public MultiTypeParameter(int modifiers, List annotations, UnionType type, VariableDeclaratorId id) { 40 | super(modifiers, annotations, id); 41 | this.type = type; 42 | } 43 | 44 | public MultiTypeParameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List annotations, UnionType type, VariableDeclaratorId id) { 45 | super(beginLine, beginColumn, endLine, endColumn, modifiers, annotations, id); 46 | this.type = type; 47 | } 48 | 49 | @Override 50 | public R accept(GenericVisitor v, A arg) { 51 | return v.visit(this, arg); 52 | } 53 | 54 | @Override 55 | public void accept(VoidVisitor v, A arg) { 56 | v.visit(this, arg); 57 | } 58 | 59 | public UnionType getType() { 60 | return type; 61 | } 62 | 63 | public void setType(UnionType type) { 64 | this.type = type; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/Parameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.TypedNode; 25 | import com.github.javaparser.ast.expr.AnnotationExpr; 26 | import com.github.javaparser.ast.type.Type; 27 | import com.github.javaparser.ast.visitor.GenericVisitor; 28 | import com.github.javaparser.ast.visitor.VoidVisitor; 29 | 30 | import java.util.List; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class Parameter extends BaseParameter implements TypedNode { 36 | private Type type; 37 | 38 | private boolean isVarArgs; 39 | 40 | public Parameter() { 41 | } 42 | 43 | public Parameter(Type type, VariableDeclaratorId id) { 44 | super(id); 45 | setType(type); 46 | } 47 | 48 | public Parameter(int modifiers, Type type, VariableDeclaratorId id) { 49 | super(modifiers, id); 50 | setType(type); 51 | } 52 | 53 | public Parameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) { 54 | super(beginLine, beginColumn, endLine, endColumn, modifiers, annotations, id); 55 | setType(type); 56 | setVarArgs(isVarArgs); 57 | } 58 | 59 | @Override 60 | public R accept(GenericVisitor v, A arg) { 61 | return v.visit(this, arg); 62 | } 63 | 64 | @Override 65 | public void accept(VoidVisitor v, A arg) { 66 | v.visit(this, arg); 67 | } 68 | 69 | @Override 70 | public Type getType() { 71 | return type; 72 | } 73 | 74 | public boolean isVarArgs() { 75 | return isVarArgs; 76 | } 77 | 78 | @Override 79 | public void setType(Type type) { 80 | this.type = type; 81 | setAsParentNodeOf(this.type); 82 | } 83 | 84 | public void setVarArgs(boolean isVarArgs) { 85 | this.isVarArgs = isVarArgs; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/TypeDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.DocumentableNode; 25 | import com.github.javaparser.ast.NamedNode; 26 | import com.github.javaparser.ast.expr.AnnotationExpr; 27 | import com.github.javaparser.ast.expr.NameExpr; 28 | 29 | import java.util.Collections; 30 | import java.util.List; 31 | 32 | import static com.github.javaparser.ast.internal.Utils.*; 33 | 34 | /** 35 | * @author Julio Vilmar Gesser 36 | */ 37 | public abstract class TypeDeclaration extends BodyDeclaration implements NamedNode, DocumentableNode { 38 | 39 | private NameExpr name; 40 | 41 | private int modifiers; 42 | 43 | private List members; 44 | 45 | public TypeDeclaration() { 46 | } 47 | 48 | public TypeDeclaration(int modifiers, String name) { 49 | setName(name); 50 | setModifiers(modifiers); 51 | } 52 | 53 | public TypeDeclaration(List annotations, 54 | int modifiers, String name, 55 | List members) { 56 | super(annotations); 57 | setName(name); 58 | setModifiers(modifiers); 59 | setMembers(members); 60 | } 61 | 62 | public TypeDeclaration(int beginLine, int beginColumn, int endLine, 63 | int endColumn, List annotations, 64 | int modifiers, String name, 65 | List members) { 66 | super(beginLine, beginColumn, endLine, endColumn, annotations); 67 | setName(name); 68 | setModifiers(modifiers); 69 | setMembers(members); 70 | } 71 | 72 | public final List getMembers() { 73 | members = ensureNotNull(members); 74 | return members; 75 | } 76 | 77 | /** 78 | * Return the modifiers of this type declaration. 79 | * 80 | * @see ModifierSet 81 | * @return modifiers 82 | */ 83 | public final int getModifiers() { 84 | return modifiers; 85 | } 86 | 87 | @Override 88 | public final String getName() { 89 | return name.getName(); 90 | } 91 | 92 | public void setMembers(List members) { 93 | this.members = members; 94 | setAsParentNodeOf(this.members); 95 | } 96 | 97 | public final void setModifiers(int modifiers) { 98 | this.modifiers = modifiers; 99 | } 100 | 101 | public final void setName(String name) { 102 | setNameExpr(new NameExpr(name)); 103 | } 104 | 105 | public final void setNameExpr(NameExpr nameExpr) { 106 | this.name = nameExpr; 107 | setAsParentNodeOf(this.name); 108 | } 109 | 110 | public final NameExpr getNameExpr() { 111 | return name; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/VariableDeclarator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.Node; 25 | import com.github.javaparser.ast.expr.Expression; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class VariableDeclarator extends Node { 33 | 34 | private VariableDeclaratorId id; 35 | 36 | private Expression init; 37 | 38 | public VariableDeclarator() { 39 | } 40 | 41 | public VariableDeclarator(VariableDeclaratorId id) { 42 | setId(id); 43 | } 44 | 45 | /** 46 | * Defines the declaration of a variable. 47 | * @param id The identifier for this variable. IE. The variables name. 48 | * @param init What this variable should be initialized to. 49 | * An {@link com.github.javaparser.ast.expr.AssignExpr} is unnecessary as the = operator is already added. 50 | */ 51 | public VariableDeclarator(VariableDeclaratorId id, Expression init) { 52 | setId(id); 53 | setInit(init); 54 | } 55 | 56 | public VariableDeclarator(int beginLine, int beginColumn, int endLine, int endColumn, VariableDeclaratorId id, Expression init) { 57 | super(beginLine, beginColumn, endLine, endColumn); 58 | setId(id); 59 | setInit(init); 60 | } 61 | 62 | @Override 63 | public R accept(GenericVisitor v, A arg) { 64 | return v.visit(this, arg); 65 | } 66 | 67 | @Override 68 | public void accept(VoidVisitor v, A arg) { 69 | v.visit(this, arg); 70 | } 71 | 72 | public VariableDeclaratorId getId() { 73 | return id; 74 | } 75 | 76 | public Expression getInit() { 77 | return init; 78 | } 79 | 80 | public void setId(VariableDeclaratorId id) { 81 | this.id = id; 82 | setAsParentNodeOf(this.id); 83 | } 84 | 85 | public void setInit(Expression init) { 86 | this.init = init; 87 | setAsParentNodeOf(this.init); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/VariableDeclaratorId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | import com.github.javaparser.ast.NamedNode; 25 | import com.github.javaparser.ast.Node; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class VariableDeclaratorId extends Node implements NamedNode { 33 | 34 | private String name; 35 | 36 | private int arrayCount; 37 | 38 | public VariableDeclaratorId() { 39 | } 40 | 41 | public VariableDeclaratorId(String name) { 42 | setName(name); 43 | } 44 | 45 | public VariableDeclaratorId(int beginLine, int beginColumn, int endLine, int endColumn, String name, int arrayCount) { 46 | super(beginLine, beginColumn, endLine, endColumn); 47 | setName(name); 48 | setArrayCount(arrayCount); 49 | } 50 | 51 | @Override 52 | public R accept(GenericVisitor v, A arg) { 53 | return v.visit(this, arg); 54 | } 55 | 56 | @Override 57 | public void accept(VoidVisitor v, A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | public int getArrayCount() { 62 | return arrayCount; 63 | } 64 | 65 | @Override 66 | public String getName() { 67 | return name; 68 | } 69 | 70 | public void setArrayCount(int arrayCount) { 71 | this.arrayCount = arrayCount; 72 | } 73 | 74 | public void setName(String name) { 75 | this.name = name; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/body/WithDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.body; 23 | 24 | /** 25 | * Element with a declaration representable as a String. 26 | * 27 | * @author Federico Tomassetti 28 | * @since July 2014 29 | */ 30 | public interface WithDeclaration { 31 | 32 | /** 33 | * As {@link WithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including 34 | * the modifiers, the throws clause and the parameters with both type and name. 35 | * @return String representation of declaration 36 | */ 37 | String getDeclarationAsString(); 38 | 39 | /** 40 | * As {@link WithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including 41 | * the parameters with both type and name. 42 | * @param includingModifiers flag to include the modifiers (if present) in the string produced 43 | * @param includingThrows flag to include the throws clause (if present) in the string produced 44 | * @return String representation of declaration based on parameter flags 45 | */ 46 | String getDeclarationAsString(boolean includingModifiers, boolean includingThrows); 47 | 48 | /** 49 | * A simple representation of the element declaration. 50 | * It should fit one string. 51 | * @param includingModifiers flag to include the modifiers (if present) in the string produced 52 | * @param includingThrows flag to include the throws clause (if present) in the string produced 53 | * @param includingParameterName flag to include the parameter name (while the parameter type is always included) in the string produced 54 | * @return String representation of declaration based on parameter flags 55 | */ 56 | String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName); 57 | } 58 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/comments/BlockComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.comments; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | *

29 | * AST node that represent block comments. 30 | *

31 | * Block comments can has multi lines and are delimited by "/*" and 32 | * "*/". 33 | * 34 | * @author Julio Vilmar Gesser 35 | */ 36 | public final class BlockComment extends Comment { 37 | 38 | public BlockComment() { 39 | } 40 | 41 | public BlockComment(String content) { 42 | super(content); 43 | } 44 | 45 | public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { 46 | super(beginLine, beginColumn, endLine, endColumn, content); 47 | } 48 | 49 | @Override 50 | public R accept(GenericVisitor v, A arg) { 51 | return v.visit(this, arg); 52 | } 53 | 54 | @Override 55 | public
void accept(VoidVisitor v, A arg) { 56 | v.visit(this, arg); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/comments/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.comments; 23 | 24 | import com.github.javaparser.ast.Node; 25 | 26 | /** 27 | * Abstract class for all AST nodes that represent comments. 28 | * 29 | * @see BlockComment 30 | * @see LineComment 31 | * @see JavadocComment 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public abstract class Comment extends Node { 35 | 36 | private String content; 37 | private Node commentedNode; 38 | 39 | public Comment() { 40 | } 41 | 42 | public Comment(String content) { 43 | this.content = content; 44 | } 45 | 46 | public Comment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | this.content = content; 49 | } 50 | 51 | /** 52 | * Return the text of the comment. 53 | * 54 | * @return text of the comment 55 | */ 56 | public final String getContent() { 57 | return content; 58 | } 59 | 60 | /** 61 | * Sets the text of the comment. 62 | * 63 | * @param content 64 | * the text of the comment to set 65 | */ 66 | public void setContent(String content) { 67 | this.content = content; 68 | } 69 | 70 | public boolean isLineComment() 71 | { 72 | return false; 73 | } 74 | 75 | public LineComment asLineComment() 76 | { 77 | if (isLineComment()) 78 | { 79 | return (LineComment) this; 80 | } else { 81 | throw new UnsupportedOperationException("Not a line comment"); 82 | } 83 | } 84 | 85 | public Node getCommentedNode() 86 | { 87 | return this.commentedNode; 88 | } 89 | 90 | public void setCommentedNode(Node commentedNode) 91 | { 92 | if (commentedNode==null) 93 | { 94 | this.commentedNode = commentedNode; 95 | return; 96 | } 97 | if (commentedNode==this) 98 | { 99 | throw new IllegalArgumentException(); 100 | } 101 | if (commentedNode instanceof Comment) 102 | { 103 | throw new IllegalArgumentException(); 104 | } 105 | this.commentedNode = commentedNode; 106 | } 107 | 108 | public boolean isOrphan() 109 | { 110 | return this.commentedNode == null; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/comments/JavadocComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.comments; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class JavadocComment extends Comment { 31 | 32 | public JavadocComment() { 33 | } 34 | 35 | public JavadocComment(String content) { 36 | super(content); 37 | } 38 | 39 | public JavadocComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { 40 | super(beginLine, beginColumn, endLine, endColumn, content); 41 | } 42 | 43 | @Override 44 | public R accept(GenericVisitor v, A arg) { 45 | return v.visit(this, arg); 46 | } 47 | 48 | @Override 49 | public void accept(VoidVisitor v, A arg) { 50 | v.visit(this, arg); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/comments/LineComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.comments; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | *

29 | * AST node that represent line comments. 30 | *

31 | * Line comments are started with "//" and finish at the end of the line ("\n"). 32 | * 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class LineComment extends Comment { 36 | 37 | public LineComment() { 38 | } 39 | 40 | public LineComment(String content) { 41 | super(content); 42 | } 43 | 44 | public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) { 45 | super(beginLine, beginColumn, endLine, endColumn, content); 46 | } 47 | 48 | @Override 49 | public R accept(GenericVisitor v, A arg) { 50 | return v.visit(this, arg); 51 | } 52 | 53 | @Override 54 | public
void accept(VoidVisitor v, A arg) { 55 | v.visit(this, arg); 56 | } 57 | 58 | @Override 59 | public boolean isLineComment() 60 | { 61 | return true; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/AnnotationExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | /** 25 | * @author Julio Vilmar Gesser 26 | */ 27 | public abstract class AnnotationExpr extends Expression { 28 | 29 | protected NameExpr name; 30 | 31 | public AnnotationExpr() {} 32 | 33 | public AnnotationExpr(int beginLine, int beginColumn, int endLine, 34 | int endColumn) { 35 | super(beginLine, beginColumn, endLine, endColumn); 36 | } 37 | 38 | public NameExpr getName() { 39 | return name; 40 | } 41 | 42 | public void setName(NameExpr name) { 43 | this.name = name; 44 | setAsParentNodeOf(name); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/ArrayAccessExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class ArrayAccessExpr extends Expression { 31 | 32 | private Expression name; 33 | 34 | private Expression index; 35 | 36 | public ArrayAccessExpr() { 37 | } 38 | 39 | public ArrayAccessExpr(Expression name, Expression index) { 40 | setName(name); 41 | setIndex(index); 42 | } 43 | 44 | public ArrayAccessExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression name, Expression index) { 45 | super(beginLine, beginColumn, endLine, endColumn); 46 | setName(name); 47 | setIndex(index); 48 | } 49 | 50 | @Override 51 | public R accept(GenericVisitor v, A arg) { 52 | return v.visit(this, arg); 53 | } 54 | 55 | @Override 56 | public void accept(VoidVisitor v, A arg) { 57 | v.visit(this, arg); 58 | } 59 | 60 | public Expression getIndex() { 61 | return index; 62 | } 63 | 64 | public Expression getName() { 65 | return name; 66 | } 67 | 68 | public void setIndex(Expression index) { 69 | this.index = index; 70 | setAsParentNodeOf(this.index); 71 | } 72 | 73 | public void setName(Expression name) { 74 | this.name = name; 75 | setAsParentNodeOf(this.name); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/ArrayInitializerExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | import java.util.List; 28 | 29 | import static com.github.javaparser.ast.internal.Utils.ensureNotNull; 30 | 31 | /** 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public final class ArrayInitializerExpr extends Expression { 35 | 36 | private List values; 37 | 38 | public ArrayInitializerExpr() { 39 | } 40 | 41 | public ArrayInitializerExpr(List values) { 42 | setValues(values); 43 | } 44 | 45 | public ArrayInitializerExpr(int beginLine, int beginColumn, int endLine, int endColumn, List values) { 46 | super(beginLine, beginColumn, endLine, endColumn); 47 | setValues(values); 48 | } 49 | 50 | @Override 51 | public R accept(GenericVisitor v, A arg) { 52 | return v.visit(this, arg); 53 | } 54 | 55 | @Override 56 | public void accept(VoidVisitor v, A arg) { 57 | v.visit(this, arg); 58 | } 59 | 60 | public List getValues() { 61 | values = ensureNotNull(values); 62 | return values; 63 | } 64 | 65 | public void setValues(List values) { 66 | this.values = values; 67 | setAsParentNodeOf(this.values); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/AssignExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class AssignExpr extends Expression { 31 | 32 | public static enum Operator { 33 | assign, // = 34 | plus, // += 35 | minus, // -= 36 | star, // *= 37 | slash, // /= 38 | and, // &= 39 | or, // |= 40 | xor, // ^= 41 | rem, // %= 42 | lShift, // <<= 43 | rSignedShift, // >>= 44 | rUnsignedShift, // >>>= 45 | } 46 | 47 | private Expression target; 48 | 49 | private Expression value; 50 | 51 | private Operator op; 52 | 53 | public AssignExpr() { 54 | } 55 | 56 | public AssignExpr(Expression target, Expression value, Operator op) { 57 | setTarget(target); 58 | setValue(value); 59 | setOperator(op); 60 | } 61 | 62 | public AssignExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression target, Expression value, Operator op) { 63 | super(beginLine, beginColumn, endLine, endColumn); 64 | setTarget(target); 65 | setValue(value); 66 | setOperator(op); 67 | } 68 | 69 | @Override 70 | public R accept(GenericVisitor v, A arg) { 71 | return v.visit(this, arg); 72 | } 73 | 74 | @Override 75 | public void accept(VoidVisitor v, A arg) { 76 | v.visit(this, arg); 77 | } 78 | 79 | public Operator getOperator() { 80 | return op; 81 | } 82 | 83 | public Expression getTarget() { 84 | return target; 85 | } 86 | 87 | public Expression getValue() { 88 | return value; 89 | } 90 | 91 | public void setOperator(Operator op) { 92 | this.op = op; 93 | } 94 | 95 | public void setTarget(Expression target) { 96 | this.target = target; 97 | setAsParentNodeOf(this.target); 98 | } 99 | 100 | public void setValue(Expression value) { 101 | this.value = value; 102 | setAsParentNodeOf(this.value); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/BinaryExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class BinaryExpr extends Expression { 31 | 32 | public static enum Operator { 33 | or, // || 34 | and, // && 35 | binOr, // | 36 | binAnd, // & 37 | xor, // ^ 38 | equals, // == 39 | notEquals, // != 40 | less, // < 41 | greater, // > 42 | lessEquals, // <= 43 | greaterEquals, // >= 44 | lShift, // << 45 | rSignedShift, // >> 46 | rUnsignedShift, // >>> 47 | plus, // + 48 | minus, // - 49 | times, // * 50 | divide, // / 51 | remainder, // % 52 | } 53 | 54 | private Expression left; 55 | 56 | private Expression right; 57 | 58 | private Operator op; 59 | 60 | public BinaryExpr() { 61 | } 62 | 63 | public BinaryExpr(Expression left, Expression right, Operator op) { 64 | setLeft(left); 65 | setRight(right); 66 | setOperator(op); 67 | } 68 | 69 | public BinaryExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression left, Expression right, Operator op) { 70 | super(beginLine, beginColumn, endLine, endColumn); 71 | setLeft(left); 72 | setRight(right); 73 | setOperator(op); 74 | } 75 | 76 | @Override 77 | public R accept(GenericVisitor v, A arg) { 78 | return v.visit(this, arg); 79 | } 80 | 81 | @Override 82 | public void accept(VoidVisitor v, A arg) { 83 | v.visit(this, arg); 84 | } 85 | 86 | public Expression getLeft() { 87 | return left; 88 | } 89 | 90 | public Operator getOperator() { 91 | return op; 92 | } 93 | 94 | public Expression getRight() { 95 | return right; 96 | } 97 | 98 | public void setLeft(Expression left) { 99 | this.left = left; 100 | setAsParentNodeOf(this.left); 101 | } 102 | 103 | public void setOperator(Operator op) { 104 | this.op = op; 105 | } 106 | 107 | public void setRight(Expression right) { 108 | this.right = right; 109 | setAsParentNodeOf(this.right); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/BooleanLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class BooleanLiteralExpr extends LiteralExpr { 31 | 32 | private boolean value; 33 | 34 | public BooleanLiteralExpr() { 35 | } 36 | 37 | public BooleanLiteralExpr(boolean value) { 38 | setValue(value); 39 | } 40 | 41 | public BooleanLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, boolean value) { 42 | super(beginLine, beginColumn, endLine, endColumn); 43 | setValue(value); 44 | } 45 | 46 | @Override 47 | public R accept(GenericVisitor v, A arg) { 48 | return v.visit(this, arg); 49 | } 50 | 51 | @Override 52 | public void accept(VoidVisitor v, A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public boolean getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue(boolean value) { 61 | this.value = value; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/CastExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.TypedNode; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class CastExpr extends Expression implements TypedNode { 33 | 34 | private Type type; 35 | 36 | private Expression expr; 37 | 38 | public CastExpr() { 39 | } 40 | 41 | public CastExpr(Type type, Expression expr) { 42 | setType(type); 43 | setExpr(expr); 44 | } 45 | 46 | public CastExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, Expression expr) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | setType(type); 49 | setExpr(expr); 50 | } 51 | 52 | @Override 53 | public R accept(GenericVisitor v, A arg) { 54 | return v.visit(this, arg); 55 | } 56 | 57 | @Override 58 | public void accept(VoidVisitor v, A arg) { 59 | v.visit(this, arg); 60 | } 61 | 62 | public Expression getExpr() { 63 | return expr; 64 | } 65 | 66 | @Override 67 | public Type getType() { 68 | return type; 69 | } 70 | 71 | public void setExpr(Expression expr) { 72 | this.expr = expr; 73 | setAsParentNodeOf(this.expr); 74 | } 75 | 76 | @Override 77 | public void setType(Type type) { 78 | this.type = type; 79 | setAsParentNodeOf(this.type); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/CharLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class CharLiteralExpr extends StringLiteralExpr { 31 | 32 | public CharLiteralExpr() { 33 | } 34 | 35 | public CharLiteralExpr(String value) { 36 | super(value); 37 | } 38 | 39 | public CharLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) { 40 | super(beginLine, beginColumn, endLine, endColumn, value); 41 | } 42 | 43 | @Override 44 | public R accept(GenericVisitor v, A arg) { 45 | return v.visit(this, arg); 46 | } 47 | 48 | @Override 49 | public void accept(VoidVisitor v, A arg) { 50 | v.visit(this, arg); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/ClassExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.TypedNode; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * Defines an expression that accesses the class of a type. 31 | * Example: 32 | * 33 | * Object.class 34 | * 35 | * @author Julio Vilmar Gesser 36 | */ 37 | public final class ClassExpr extends Expression implements TypedNode { 38 | 39 | private Type type; 40 | 41 | public ClassExpr() { 42 | } 43 | 44 | public ClassExpr(Type type) { 45 | setType(type); 46 | } 47 | 48 | public ClassExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type) { 49 | super(beginLine, beginColumn, endLine, endColumn); 50 | setType(type); 51 | } 52 | 53 | @Override 54 | public R accept(GenericVisitor v, A arg) { 55 | return v.visit(this, arg); 56 | } 57 | 58 | @Override 59 | public void accept(VoidVisitor v, A arg) { 60 | v.visit(this, arg); 61 | } 62 | 63 | @Override 64 | public Type getType() { 65 | return type; 66 | } 67 | 68 | @Override 69 | public void setType(Type type) { 70 | this.type = type; 71 | setAsParentNodeOf(this.type); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/ConditionalExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class ConditionalExpr extends Expression { 31 | 32 | private Expression condition; 33 | 34 | private Expression thenExpr; 35 | 36 | private Expression elseExpr; 37 | 38 | public ConditionalExpr() { 39 | } 40 | 41 | public ConditionalExpr(Expression condition, Expression thenExpr, Expression elseExpr) { 42 | setCondition(condition); 43 | setThenExpr(thenExpr); 44 | setElseExpr(elseExpr); 45 | } 46 | 47 | public ConditionalExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression condition, Expression thenExpr, Expression elseExpr) { 48 | super(beginLine, beginColumn, endLine, endColumn); 49 | setCondition(condition); 50 | setThenExpr(thenExpr); 51 | setElseExpr(elseExpr); 52 | } 53 | 54 | @Override 55 | public R accept(GenericVisitor v, A arg) { 56 | return v.visit(this, arg); 57 | } 58 | 59 | @Override 60 | public void accept(VoidVisitor v, A arg) { 61 | v.visit(this, arg); 62 | } 63 | 64 | public Expression getCondition() { 65 | return condition; 66 | } 67 | 68 | public Expression getElseExpr() { 69 | return elseExpr; 70 | } 71 | 72 | public Expression getThenExpr() { 73 | return thenExpr; 74 | } 75 | 76 | public void setCondition(Expression condition) { 77 | this.condition = condition; 78 | setAsParentNodeOf(this.condition); 79 | } 80 | 81 | public void setElseExpr(Expression elseExpr) { 82 | this.elseExpr = elseExpr; 83 | setAsParentNodeOf(this.elseExpr); 84 | } 85 | 86 | public void setThenExpr(Expression thenExpr) { 87 | this.thenExpr = thenExpr; 88 | setAsParentNodeOf(this.thenExpr); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/DoubleLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class DoubleLiteralExpr extends StringLiteralExpr { 31 | 32 | public DoubleLiteralExpr() { 33 | } 34 | 35 | public DoubleLiteralExpr(final String value) { 36 | super(value); 37 | } 38 | 39 | public DoubleLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 40 | final String value) { 41 | super(beginLine, beginColumn, endLine, endColumn, value); 42 | } 43 | 44 | @Override public R accept(final GenericVisitor v, final A arg) { 45 | return v.visit(this, arg); 46 | } 47 | 48 | @Override public void accept(final VoidVisitor v, final A arg) { 49 | v.visit(this, arg); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/EnclosedExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class EnclosedExpr extends Expression { 31 | 32 | private Expression inner; 33 | 34 | public EnclosedExpr() { 35 | } 36 | 37 | public EnclosedExpr(final Expression inner) { 38 | setInner(inner); 39 | } 40 | 41 | public EnclosedExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 42 | final Expression inner) { 43 | super(beginLine, beginColumn, endLine, endColumn); 44 | setInner(inner); 45 | } 46 | 47 | @Override public R accept(final GenericVisitor v, final A arg) { 48 | return v.visit(this, arg); 49 | } 50 | 51 | @Override public void accept(final VoidVisitor v, final A arg) { 52 | v.visit(this, arg); 53 | } 54 | 55 | public Expression getInner() { 56 | return inner; 57 | } 58 | 59 | public void setInner(final Expression inner) { 60 | this.inner = inner; 61 | setAsParentNodeOf(this.inner); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/Expression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.Node; 25 | 26 | /** 27 | * @author Julio Vilmar Gesser 28 | */ 29 | public abstract class Expression extends Node { 30 | 31 | public Expression() { 32 | } 33 | 34 | public Expression(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 35 | super(beginLine, beginColumn, endLine, endColumn); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/FieldAccessExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.type.Type; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class FieldAccessExpr extends Expression { 36 | 37 | private Expression scope; 38 | 39 | private List typeArgs; 40 | 41 | private NameExpr field; 42 | 43 | public FieldAccessExpr() { 44 | } 45 | 46 | public FieldAccessExpr(final Expression scope, final String field) { 47 | setScope(scope); 48 | setField(field); 49 | } 50 | 51 | public FieldAccessExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 52 | final Expression scope, final List typeArgs, final String field) { 53 | super(beginLine, beginColumn, endLine, endColumn); 54 | setScope(scope); 55 | setTypeArgs(typeArgs); 56 | setField(field); 57 | } 58 | 59 | @Override public R accept(final GenericVisitor v, final A arg) { 60 | return v.visit(this, arg); 61 | } 62 | 63 | @Override public void accept(final VoidVisitor v, final A arg) { 64 | v.visit(this, arg); 65 | } 66 | 67 | public String getField() { 68 | return field.getName(); 69 | } 70 | 71 | public NameExpr getFieldExpr() { 72 | return field; 73 | } 74 | 75 | public Expression getScope() { 76 | return scope; 77 | } 78 | 79 | public List getTypeArgs() { 80 | typeArgs = ensureNotNull(typeArgs); 81 | return typeArgs; 82 | } 83 | 84 | public void setField(final String field) { 85 | setFieldExpr(new NameExpr(field)); 86 | } 87 | 88 | public void setFieldExpr(NameExpr field) { 89 | this.field = field; 90 | setAsParentNodeOf(this.field); 91 | } 92 | 93 | public void setScope(final Expression scope) { 94 | this.scope = scope; 95 | setAsParentNodeOf(this.scope); 96 | } 97 | 98 | public void setTypeArgs(final List typeArgs) { 99 | this.typeArgs = typeArgs; 100 | setAsParentNodeOf(this.typeArgs); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/InstanceOfExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.TypedNode; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class InstanceOfExpr extends Expression implements TypedNode { 33 | 34 | private Expression expr; 35 | 36 | private Type type; 37 | 38 | public InstanceOfExpr() { 39 | } 40 | 41 | public InstanceOfExpr(final Expression expr, final Type type) { 42 | setExpr(expr); 43 | setType(type); 44 | } 45 | 46 | public InstanceOfExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 47 | final Expression expr, final Type type) { 48 | super(beginLine, beginColumn, endLine, endColumn); 49 | setExpr(expr); 50 | setType(type); 51 | } 52 | 53 | @Override public R accept(final GenericVisitor v, final A arg) { 54 | return v.visit(this, arg); 55 | } 56 | 57 | @Override public void accept(final VoidVisitor v, final A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | public Expression getExpr() { 62 | return expr; 63 | } 64 | 65 | @Override 66 | public Type getType() { 67 | return type; 68 | } 69 | 70 | public void setExpr(final Expression expr) { 71 | this.expr = expr; 72 | setAsParentNodeOf(this.expr); 73 | } 74 | 75 | @Override 76 | public void setType(final Type type) { 77 | this.type = type; 78 | setAsParentNodeOf(this.type); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/IntegerLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public class IntegerLiteralExpr extends StringLiteralExpr { 31 | 32 | private static final String UNSIGNED_MIN_VALUE = "2147483648"; 33 | 34 | protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE; 35 | 36 | public IntegerLiteralExpr() { 37 | } 38 | 39 | public IntegerLiteralExpr(final String value) { 40 | super(value); 41 | } 42 | 43 | public IntegerLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 44 | final String value) { 45 | super(beginLine, beginColumn, endLine, endColumn, value); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public final boolean isMinValue() { 57 | return value != null && // 58 | value.length() == 10 && // 59 | value.equals(UNSIGNED_MIN_VALUE); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class IntegerLiteralMinValueExpr extends IntegerLiteralExpr { 31 | 32 | public IntegerLiteralMinValueExpr() { 33 | super(MIN_VALUE); 34 | } 35 | 36 | public IntegerLiteralMinValueExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 37 | super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE); 38 | } 39 | 40 | @Override public R accept(final GenericVisitor v, final A arg) { 41 | return v.visit(this, arg); 42 | } 43 | 44 | @Override public void accept(final VoidVisitor v, final A arg) { 45 | v.visit(this, arg); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/LambdaExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.body.Parameter; 25 | import com.github.javaparser.ast.stmt.Statement; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | import java.util.List; 30 | 31 | import static com.github.javaparser.ast.internal.Utils.*; 32 | 33 | /** 34 | * Lambda expression. 35 | * 36 | * @author Raquel Pau 37 | */ 38 | public class LambdaExpr extends Expression { 39 | 40 | private List parameters; 41 | 42 | private boolean parametersEnclosed; 43 | 44 | private Statement body; 45 | 46 | public LambdaExpr() { 47 | } 48 | 49 | public LambdaExpr(int beginLine, int beginColumn, int endLine, 50 | int endColumn, List parameters, Statement body, 51 | boolean parametersEnclosed) { 52 | 53 | super(beginLine, beginColumn, endLine, endColumn); 54 | setParameters(parameters); 55 | setBody(body); 56 | setParametersEnclosed(parametersEnclosed); 57 | } 58 | 59 | public List getParameters() { 60 | parameters = ensureNotNull(parameters); 61 | return parameters; 62 | } 63 | 64 | public void setParameters(List parameters) { 65 | this.parameters = parameters; 66 | setAsParentNodeOf(this.parameters); 67 | } 68 | 69 | public Statement getBody() { 70 | return body; 71 | } 72 | 73 | public void setBody(Statement body) { 74 | this.body = body; 75 | setAsParentNodeOf(this.body); 76 | } 77 | 78 | @Override 79 | public R accept(GenericVisitor v, A arg) { 80 | return v.visit(this, arg); 81 | } 82 | 83 | @Override 84 | public void accept(VoidVisitor v, A arg) { 85 | v.visit(this, arg); 86 | } 87 | 88 | public boolean isParametersEnclosed() { 89 | return parametersEnclosed; 90 | } 91 | 92 | public void setParametersEnclosed(boolean parametersEnclosed) { 93 | this.parametersEnclosed = parametersEnclosed; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/LiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | /** 25 | * @author Julio Vilmar Gesser 26 | */ 27 | public abstract class LiteralExpr extends Expression { 28 | 29 | public LiteralExpr() { 30 | } 31 | 32 | public LiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 33 | super(beginLine, beginColumn, endLine, endColumn); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/LongLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public class LongLiteralExpr extends StringLiteralExpr { 31 | 32 | private static final String UNSIGNED_MIN_VALUE = "9223372036854775808"; 33 | 34 | protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE + "L"; 35 | 36 | public LongLiteralExpr() { 37 | } 38 | 39 | public LongLiteralExpr(final String value) { 40 | super(value); 41 | } 42 | 43 | public LongLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 44 | final String value) { 45 | super(beginLine, beginColumn, endLine, endColumn, value); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public final boolean isMinValue() { 57 | return value != null && // 58 | value.length() == 20 && // 59 | value.startsWith(UNSIGNED_MIN_VALUE) && // 60 | (value.charAt(19) == 'L' || value.charAt(19) == 'l'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class LongLiteralMinValueExpr extends LongLiteralExpr { 31 | 32 | public LongLiteralMinValueExpr() { 33 | super(MIN_VALUE); 34 | } 35 | 36 | public LongLiteralMinValueExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 37 | super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE); 38 | } 39 | 40 | @Override public R accept(final GenericVisitor v, final A arg) { 41 | return v.visit(this, arg); 42 | } 43 | 44 | @Override public void accept(final VoidVisitor v, final A arg) { 45 | v.visit(this, arg); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class MarkerAnnotationExpr extends AnnotationExpr { 31 | 32 | public MarkerAnnotationExpr() { 33 | } 34 | 35 | public MarkerAnnotationExpr(final NameExpr name) { 36 | setName(name); 37 | } 38 | 39 | public MarkerAnnotationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 40 | final NameExpr name) { 41 | super(beginLine, beginColumn, endLine, endColumn); 42 | setName(name); 43 | } 44 | 45 | @Override public R accept(final GenericVisitor v, final A arg) { 46 | return v.visit(this, arg); 47 | } 48 | 49 | @Override public void accept(final VoidVisitor v, final A arg) { 50 | v.visit(this, arg); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/MemberValuePair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.NamedNode; 25 | import com.github.javaparser.ast.Node; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class MemberValuePair extends Node implements NamedNode { 33 | 34 | private String name; 35 | 36 | private Expression value; 37 | 38 | public MemberValuePair() { 39 | } 40 | 41 | public MemberValuePair(final String name, final Expression value) { 42 | setName(name); 43 | setValue(value); 44 | } 45 | 46 | public MemberValuePair(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 47 | final String name, final Expression value) { 48 | super(beginLine, beginColumn, endLine, endColumn); 49 | setName(name); 50 | setValue(value); 51 | } 52 | 53 | @Override public R accept(final GenericVisitor v, final A arg) { 54 | return v.visit(this, arg); 55 | } 56 | 57 | @Override public void accept(final VoidVisitor v, final A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | @Override 62 | public String getName() { 63 | return name; 64 | } 65 | 66 | public Expression getValue() { 67 | return value; 68 | } 69 | 70 | public void setName(final String name) { 71 | this.name = name; 72 | } 73 | 74 | public void setValue(final Expression value) { 75 | this.value = value; 76 | setAsParentNodeOf(this.value); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/MethodCallExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.type.Type; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class MethodCallExpr extends Expression { 36 | 37 | private Expression scope; 38 | 39 | private List typeArgs; 40 | 41 | private NameExpr name; 42 | 43 | private List args; 44 | 45 | public MethodCallExpr() { 46 | } 47 | 48 | public MethodCallExpr(final Expression scope, final String name) { 49 | setScope(scope); 50 | setName(name); 51 | } 52 | 53 | public MethodCallExpr(final Expression scope, final String name, final List args) { 54 | setScope(scope); 55 | setName(name); 56 | setArgs(args); 57 | } 58 | 59 | public MethodCallExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 60 | final Expression scope, final List typeArgs, final String name, final List args) { 61 | super(beginLine, beginColumn, endLine, endColumn); 62 | setScope(scope); 63 | setTypeArgs(typeArgs); 64 | setName(name); 65 | setArgs(args); 66 | } 67 | 68 | @Override public R accept(final GenericVisitor v, final A arg) { 69 | return v.visit(this, arg); 70 | } 71 | 72 | @Override public void accept(final VoidVisitor v, final A arg) { 73 | v.visit(this, arg); 74 | } 75 | 76 | public List getArgs() { 77 | args = ensureNotNull(args); 78 | return args; 79 | } 80 | 81 | public String getName() { 82 | return name.getName(); 83 | } 84 | 85 | public NameExpr getNameExpr() { 86 | return name; 87 | } 88 | 89 | public Expression getScope() { 90 | return scope; 91 | } 92 | 93 | public List getTypeArgs() { 94 | typeArgs = ensureNotNull(typeArgs); 95 | return typeArgs; 96 | } 97 | 98 | public void setArgs(final List args) { 99 | this.args = args; 100 | setAsParentNodeOf(this.args); 101 | } 102 | 103 | public void setName(final String name) { 104 | setNameExpr(new NameExpr(name)); 105 | } 106 | 107 | public void setNameExpr(NameExpr name) { 108 | this.name = name; 109 | setAsParentNodeOf(this.name); 110 | } 111 | 112 | public void setScope(final Expression scope) { 113 | this.scope = scope; 114 | setAsParentNodeOf(this.scope); 115 | } 116 | 117 | public void setTypeArgs(final List typeArgs) { 118 | this.typeArgs = typeArgs; 119 | setAsParentNodeOf(this.typeArgs); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/MethodReferenceExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.TypeParameter; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * Method reference expressions introduced in Java 8 specifically designed to simplify lambda Expressions. 34 | * These are some examples: 35 | * 36 | * System.out::println; 37 | * 38 | * (test ? stream.map(String::trim) : stream)::toArray; 39 | * @author Raquel Pau 40 | * 41 | */ 42 | public class MethodReferenceExpr extends Expression { 43 | 44 | private Expression scope; 45 | 46 | private List typeParameters; 47 | 48 | private String identifier; 49 | 50 | public MethodReferenceExpr() { 51 | } 52 | 53 | public MethodReferenceExpr(int beginLine, int beginColumn, int endLine, 54 | int endColumn, Expression scope, 55 | List typeParameters, String identifier) { 56 | 57 | super(beginLine, beginColumn, endLine, endColumn); 58 | setIdentifier(identifier); 59 | setScope(scope); 60 | setTypeParameters(typeParameters); 61 | } 62 | 63 | @Override 64 | public R accept(GenericVisitor v, A arg) { 65 | 66 | return v.visit(this, arg); 67 | } 68 | 69 | @Override 70 | public void accept(VoidVisitor v, A arg) { 71 | v.visit(this, arg); 72 | } 73 | 74 | public Expression getScope() { 75 | return scope; 76 | } 77 | 78 | public void setScope(Expression scope) { 79 | this.scope = scope; 80 | setAsParentNodeOf(this.scope); 81 | } 82 | 83 | public List getTypeParameters() { 84 | typeParameters = ensureNotNull(typeParameters); 85 | return typeParameters; 86 | } 87 | 88 | public void setTypeParameters(List typeParameters) { 89 | this.typeParameters = typeParameters; 90 | setAsParentNodeOf(this.typeParameters); 91 | } 92 | 93 | public String getIdentifier() { 94 | return identifier; 95 | } 96 | 97 | public void setIdentifier(String identifier) { 98 | this.identifier = identifier; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/NameExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.NamedNode; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public class NameExpr extends Expression implements NamedNode { 32 | 33 | private String name; 34 | 35 | public NameExpr() { 36 | } 37 | 38 | public NameExpr(final String name) { 39 | this.name = name; 40 | } 41 | 42 | public NameExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final String name) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | this.name = name; 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | @Override 57 | public final String getName() { 58 | return name; 59 | } 60 | 61 | public final void setName(final String name) { 62 | this.name = name; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/NormalAnnotationExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | import java.util.List; 28 | 29 | import static com.github.javaparser.ast.internal.Utils.*; 30 | 31 | /** 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public final class NormalAnnotationExpr extends AnnotationExpr { 35 | 36 | private List pairs; 37 | 38 | public NormalAnnotationExpr() { 39 | } 40 | 41 | public NormalAnnotationExpr(final NameExpr name, final List pairs) { 42 | setName(name); 43 | setPairs(pairs); 44 | } 45 | 46 | public NormalAnnotationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 47 | final NameExpr name, final List pairs) { 48 | super(beginLine, beginColumn, endLine, endColumn); 49 | setName(name); 50 | setPairs(pairs); 51 | } 52 | 53 | @Override public R accept(final GenericVisitor v, final A arg) { 54 | return v.visit(this, arg); 55 | } 56 | 57 | @Override public void accept(final VoidVisitor v, final A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | public List getPairs() { 62 | pairs = ensureNotNull(pairs); 63 | return pairs; 64 | } 65 | 66 | public void setPairs(final List pairs) { 67 | this.pairs = pairs; 68 | setAsParentNodeOf(this.pairs); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/NullLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class NullLiteralExpr extends LiteralExpr { 31 | 32 | public NullLiteralExpr() { 33 | } 34 | 35 | public NullLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 36 | super(beginLine, beginColumn, endLine, endColumn); 37 | } 38 | 39 | @Override public R accept(final GenericVisitor v, final A arg) { 40 | return v.visit(this, arg); 41 | } 42 | 43 | @Override public void accept(final VoidVisitor v, final A arg) { 44 | v.visit(this, arg); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/QualifiedNameExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class QualifiedNameExpr extends NameExpr { 31 | 32 | private NameExpr qualifier; 33 | 34 | public QualifiedNameExpr() { 35 | } 36 | 37 | public QualifiedNameExpr(final NameExpr scope, final String name) { 38 | super(name); 39 | setQualifier(scope); 40 | } 41 | 42 | public QualifiedNameExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final NameExpr scope, final String name) { 44 | super(beginLine, beginColumn, endLine, endColumn, name); 45 | setQualifier(scope); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public NameExpr getQualifier() { 57 | return qualifier; 58 | } 59 | 60 | public void setQualifier(final NameExpr qualifier) { 61 | this.qualifier = qualifier; 62 | setAsParentNodeOf(this.qualifier); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class SingleMemberAnnotationExpr extends AnnotationExpr { 31 | 32 | private Expression memberValue; 33 | 34 | public SingleMemberAnnotationExpr() { 35 | } 36 | 37 | public SingleMemberAnnotationExpr(final NameExpr name, final Expression memberValue) { 38 | setName(name); 39 | setMemberValue(memberValue); 40 | } 41 | 42 | public SingleMemberAnnotationExpr(final int beginLine, final int beginColumn, final int endLine, 43 | final int endColumn, final NameExpr name, final Expression memberValue) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | setName(name); 46 | setMemberValue(memberValue); 47 | } 48 | 49 | @Override public R accept(final GenericVisitor v, final A arg) { 50 | return v.visit(this, arg); 51 | } 52 | 53 | @Override public void accept(final VoidVisitor v, final A arg) { 54 | v.visit(this, arg); 55 | } 56 | 57 | public Expression getMemberValue() { 58 | return memberValue; 59 | } 60 | 61 | public void setMemberValue(final Expression memberValue) { 62 | this.memberValue = memberValue; 63 | setAsParentNodeOf(this.memberValue); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/StringLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public class StringLiteralExpr extends LiteralExpr { 31 | 32 | protected String value; 33 | 34 | public StringLiteralExpr() { 35 | this.value = ""; 36 | } 37 | 38 | public StringLiteralExpr(final String value) { 39 | if (value.contains("\n") || value.contains("\r")) { 40 | throw new IllegalArgumentException("Illegal literal expression: newlines (line feed or carriage return) have to be escaped"); 41 | } 42 | this.value = value; 43 | } 44 | 45 | public StringLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 46 | final String value) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | this.value = value; 49 | } 50 | 51 | @Override public R accept(final GenericVisitor v, final A arg) { 52 | return v.visit(this, arg); 53 | } 54 | 55 | @Override public void accept(final VoidVisitor v, final A arg) { 56 | v.visit(this, arg); 57 | } 58 | 59 | public final String getValue() { 60 | return value; 61 | } 62 | 63 | public final void setValue(final String value) { 64 | this.value = value; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/SuperExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class SuperExpr extends Expression { 31 | 32 | private Expression classExpr; 33 | 34 | public SuperExpr() { 35 | } 36 | 37 | public SuperExpr(final Expression classExpr) { 38 | setClassExpr(classExpr); 39 | } 40 | 41 | public SuperExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 42 | final Expression classExpr) { 43 | super(beginLine, beginColumn, endLine, endColumn); 44 | setClassExpr(classExpr); 45 | } 46 | 47 | @Override public R accept(final GenericVisitor v, final A arg) { 48 | return v.visit(this, arg); 49 | } 50 | 51 | @Override public void accept(final VoidVisitor v, final A arg) { 52 | v.visit(this, arg); 53 | } 54 | 55 | public Expression getClassExpr() { 56 | return classExpr; 57 | } 58 | 59 | public void setClassExpr(final Expression classExpr) { 60 | this.classExpr = classExpr; 61 | setAsParentNodeOf(this.classExpr); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/ThisExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class ThisExpr extends Expression { 31 | 32 | private Expression classExpr; 33 | 34 | public ThisExpr() { 35 | } 36 | 37 | public ThisExpr(final Expression classExpr) { 38 | setClassExpr(classExpr); 39 | } 40 | 41 | public ThisExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 42 | final Expression classExpr) { 43 | super(beginLine, beginColumn, endLine, endColumn); 44 | setClassExpr(classExpr); 45 | } 46 | 47 | @Override public R accept(final GenericVisitor v, final A arg) { 48 | return v.visit(this, arg); 49 | } 50 | 51 | @Override public void accept(final VoidVisitor v, final A arg) { 52 | v.visit(this, arg); 53 | } 54 | 55 | public Expression getClassExpr() { 56 | return classExpr; 57 | } 58 | 59 | public void setClassExpr(final Expression classExpr) { 60 | this.classExpr = classExpr; 61 | setAsParentNodeOf(this.classExpr); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/TypeExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.TypedNode; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * This class is just instantiated as scopes for MethodReferenceExpr nodes to encapsulate Types. 31 | * @author Raquel Pau 32 | * 33 | */ 34 | public class TypeExpr extends Expression implements TypedNode { 35 | 36 | private Type type; 37 | 38 | public TypeExpr(){} 39 | 40 | public TypeExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type) { 41 | super(beginLine, beginColumn, endLine, endColumn); 42 | setType(type); 43 | } 44 | 45 | @Override 46 | public R accept(GenericVisitor v, A arg) { 47 | return v.visit(this, arg); 48 | } 49 | 50 | @Override 51 | public void accept(VoidVisitor v, A arg) { 52 | v.visit(this, arg); 53 | } 54 | 55 | @Override 56 | public Type getType() { 57 | return type; 58 | } 59 | 60 | @Override 61 | public void setType(Type type) { 62 | this.type = type; 63 | setAsParentNodeOf(this.type); 64 | } 65 | 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/expr/UnaryExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.expr; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class UnaryExpr extends Expression { 31 | 32 | public static enum Operator { 33 | positive, // + 34 | negative, // - 35 | preIncrement, // ++ 36 | preDecrement, // -- 37 | not, // ! 38 | inverse, // ~ 39 | posIncrement, // ++ 40 | posDecrement, // -- 41 | } 42 | 43 | private Expression expr; 44 | 45 | private Operator op; 46 | 47 | public UnaryExpr() { 48 | } 49 | 50 | public UnaryExpr(final Expression expr, final Operator op) { 51 | setExpr(expr); 52 | setOperator(op); 53 | } 54 | 55 | public UnaryExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 56 | final Expression expr, final Operator op) { 57 | super(beginLine, beginColumn, endLine, endColumn); 58 | setExpr(expr); 59 | setOperator(op); 60 | } 61 | 62 | @Override public R accept(final GenericVisitor v, final A arg) { 63 | return v.visit(this, arg); 64 | } 65 | 66 | @Override public void accept(final VoidVisitor v, final A arg) { 67 | v.visit(this, arg); 68 | } 69 | 70 | public Expression getExpr() { 71 | return expr; 72 | } 73 | 74 | public Operator getOperator() { 75 | return op; 76 | } 77 | 78 | public void setExpr(final Expression expr) { 79 | this.expr = expr; 80 | setAsParentNodeOf(this.expr); 81 | } 82 | 83 | public void setOperator(final Operator op) { 84 | this.op = op; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/internal/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.internal; 23 | 24 | import java.util.ArrayList; 25 | import java.util.Collection; 26 | import java.util.List; 27 | 28 | /** 29 | * @author Federico Tomassetti 30 | * @since 3.0.0 31 | */ 32 | public class Utils { 33 | public static List ensureNotNull(List list) { 34 | return list == null ? new ArrayList() : list; 35 | } 36 | 37 | public static boolean isNullOrEmpty(Collection collection) { 38 | return collection == null || collection.isEmpty(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/AssertStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class AssertStmt extends Statement { 32 | 33 | private Expression check; 34 | 35 | private Expression msg; 36 | 37 | public AssertStmt() { 38 | } 39 | 40 | public AssertStmt(final Expression check) { 41 | setCheck(check); 42 | } 43 | 44 | public AssertStmt(final Expression check, final Expression msg) { 45 | setCheck(check); 46 | setMessage(msg); 47 | } 48 | 49 | public AssertStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 50 | final Expression check, final Expression msg) { 51 | super(beginLine, beginColumn, endLine, endColumn); 52 | 53 | setCheck(check); 54 | setMessage(msg); 55 | 56 | } 57 | 58 | @Override public R accept(final GenericVisitor v, final A arg) { 59 | return v.visit(this, arg); 60 | } 61 | 62 | @Override public void accept(final VoidVisitor v, final A arg) { 63 | v.visit(this, arg); 64 | } 65 | 66 | public Expression getCheck() { 67 | return check; 68 | } 69 | 70 | public Expression getMessage() { 71 | return msg; 72 | } 73 | 74 | public void setCheck(final Expression check) { 75 | this.check = check; 76 | setAsParentNodeOf(this.check); 77 | } 78 | 79 | public void setMessage(final Expression msg) { 80 | this.msg = msg; 81 | setAsParentNodeOf(this.msg); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/BlockStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | import java.util.List; 28 | 29 | import static com.github.javaparser.ast.internal.Utils.*; 30 | 31 | /** 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public final class BlockStmt extends Statement { 35 | 36 | private List stmts; 37 | 38 | public BlockStmt() { 39 | } 40 | 41 | public BlockStmt(final List stmts) { 42 | setStmts(stmts); 43 | } 44 | 45 | public BlockStmt(final int beginLine, final int beginColumn, 46 | final int endLine, final int endColumn, final List stmts) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | setStmts(stmts); 49 | } 50 | 51 | @Override 52 | public R accept(final GenericVisitor v, final A arg) { 53 | return v.visit(this, arg); 54 | } 55 | 56 | @Override 57 | public void accept(final VoidVisitor v, final A arg) { 58 | v.visit(this, arg); 59 | } 60 | 61 | public List getStmts() { 62 | stmts = ensureNotNull(stmts); 63 | return stmts; 64 | } 65 | 66 | public void setStmts(final List stmts) { 67 | this.stmts = stmts; 68 | setAsParentNodeOf(this.stmts); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/BreakStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class BreakStmt extends Statement { 31 | 32 | private String id; 33 | 34 | public BreakStmt() { 35 | } 36 | 37 | public BreakStmt(final String id) { 38 | this.id = id; 39 | } 40 | 41 | public BreakStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final String id) { 42 | super(beginLine, beginColumn, endLine, endColumn); 43 | this.id = id; 44 | } 45 | 46 | @Override public R accept(final GenericVisitor v, final A arg) { 47 | return v.visit(this, arg); 48 | } 49 | 50 | @Override public void accept(final VoidVisitor v, final A arg) { 51 | v.visit(this, arg); 52 | } 53 | 54 | public String getId() { 55 | return id; 56 | } 57 | 58 | public void setId(final String id) { 59 | this.id = id; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/CatchClause.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.Node; 25 | import com.github.javaparser.ast.body.MultiTypeParameter; 26 | import com.github.javaparser.ast.body.Parameter; 27 | import com.github.javaparser.ast.body.VariableDeclaratorId; 28 | import com.github.javaparser.ast.expr.AnnotationExpr; 29 | import com.github.javaparser.ast.type.Type; 30 | import com.github.javaparser.ast.type.UnionType; 31 | import com.github.javaparser.ast.visitor.GenericVisitor; 32 | import com.github.javaparser.ast.visitor.VoidVisitor; 33 | 34 | import java.util.List; 35 | 36 | /** 37 | * @author Julio Vilmar Gesser 38 | */ 39 | public final class CatchClause extends Node { 40 | 41 | private Parameter param; 42 | 43 | private BlockStmt catchBlock; 44 | 45 | public CatchClause() { 46 | } 47 | 48 | public CatchClause(final Parameter param, final BlockStmt catchBlock) { 49 | setParam(param); 50 | setCatchBlock(catchBlock); 51 | } 52 | 53 | public CatchClause(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 54 | final int exceptModifier, final List exceptAnnotations, final Type exceptTypes, 55 | final VariableDeclaratorId exceptId, final BlockStmt catchBlock) { 56 | super(beginLine, beginColumn, endLine, endColumn); 57 | setParam(new Parameter(beginLine, beginColumn, endLine, endColumn, exceptModifier, exceptAnnotations, exceptTypes, false, exceptId)); 58 | setCatchBlock(catchBlock); 59 | } 60 | 61 | @Override public R accept(final GenericVisitor v, final A arg) { 62 | return v.visit(this, arg); 63 | } 64 | 65 | @Override public void accept(final VoidVisitor v, final A arg) { 66 | v.visit(this, arg); 67 | } 68 | 69 | public BlockStmt getCatchBlock() { 70 | return catchBlock; 71 | } 72 | 73 | public Parameter getParam() { 74 | return param; 75 | } 76 | 77 | public void setCatchBlock(final BlockStmt catchBlock) { 78 | this.catchBlock = catchBlock; 79 | setAsParentNodeOf(this.catchBlock); 80 | } 81 | 82 | public void setParam(final Parameter param) { 83 | this.param = param; 84 | setAsParentNodeOf(this.param); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ContinueStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class ContinueStmt extends Statement { 31 | 32 | private String id; 33 | 34 | public ContinueStmt() { 35 | } 36 | 37 | public ContinueStmt(final String id) { 38 | this.id = id; 39 | } 40 | 41 | public ContinueStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 42 | final String id) { 43 | super(beginLine, beginColumn, endLine, endColumn); 44 | this.id = id; 45 | } 46 | 47 | @Override public R accept(final GenericVisitor v, final A arg) { 48 | return v.visit(this, arg); 49 | } 50 | 51 | @Override public void accept(final VoidVisitor v, final A arg) { 52 | v.visit(this, arg); 53 | } 54 | 55 | public String getId() { 56 | return id; 57 | } 58 | 59 | public void setId(final String id) { 60 | this.id = id; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/DoStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class DoStmt extends Statement { 32 | 33 | private Statement body; 34 | 35 | private Expression condition; 36 | 37 | public DoStmt() { 38 | } 39 | 40 | public DoStmt(final Statement body, final Expression condition) { 41 | setBody(body); 42 | setCondition(condition); 43 | } 44 | 45 | public DoStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 46 | final Statement body, final Expression condition) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | setBody(body); 49 | setCondition(condition); 50 | } 51 | 52 | @Override public R accept(final GenericVisitor v, final A arg) { 53 | return v.visit(this, arg); 54 | } 55 | 56 | @Override public void accept(final VoidVisitor v, final A arg) { 57 | v.visit(this, arg); 58 | } 59 | 60 | public Statement getBody() { 61 | return body; 62 | } 63 | 64 | public Expression getCondition() { 65 | return condition; 66 | } 67 | 68 | public void setBody(final Statement body) { 69 | this.body = body; 70 | setAsParentNodeOf(this.body); 71 | } 72 | 73 | public void setCondition(final Expression condition) { 74 | this.condition = condition; 75 | setAsParentNodeOf(this.condition); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/EmptyStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class EmptyStmt extends Statement { 31 | 32 | public EmptyStmt() { 33 | } 34 | 35 | public EmptyStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 36 | super(beginLine, beginColumn, endLine, endColumn); 37 | } 38 | 39 | @Override public R accept(final GenericVisitor v, final A arg) { 40 | return v.visit(this, arg); 41 | } 42 | 43 | @Override public void accept(final VoidVisitor v, final A arg) { 44 | v.visit(this, arg); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.type.Type; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | import java.util.List; 30 | 31 | import static com.github.javaparser.ast.internal.Utils.*; 32 | 33 | /** 34 | * @author Julio Vilmar Gesser 35 | */ 36 | public final class ExplicitConstructorInvocationStmt extends Statement { 37 | 38 | private List typeArgs; 39 | 40 | private boolean isThis; 41 | 42 | private Expression expr; 43 | 44 | private List args; 45 | 46 | public ExplicitConstructorInvocationStmt() { 47 | } 48 | 49 | public ExplicitConstructorInvocationStmt(final boolean isThis, 50 | final Expression expr, final List args) { 51 | setThis(isThis); 52 | setExpr(expr); 53 | setArgs(args); 54 | } 55 | 56 | public ExplicitConstructorInvocationStmt(final int beginLine, 57 | final int beginColumn, final int endLine, final int endColumn, 58 | final List typeArgs, final boolean isThis, 59 | final Expression expr, final List args) { 60 | super(beginLine, beginColumn, endLine, endColumn); 61 | setTypeArgs(typeArgs); 62 | setThis(isThis); 63 | setExpr(expr); 64 | setArgs(args); 65 | } 66 | 67 | @Override 68 | public R accept(final GenericVisitor v, final A arg) { 69 | return v.visit(this, arg); 70 | } 71 | 72 | @Override 73 | public void accept(final VoidVisitor v, final A arg) { 74 | v.visit(this, arg); 75 | } 76 | 77 | public List getArgs() { 78 | args = ensureNotNull(args); 79 | return args; 80 | } 81 | 82 | public Expression getExpr() { 83 | return expr; 84 | } 85 | 86 | public List getTypeArgs() { 87 | typeArgs = ensureNotNull(typeArgs); 88 | return typeArgs; 89 | } 90 | 91 | public boolean isThis() { 92 | return isThis; 93 | } 94 | 95 | public void setArgs(final List args) { 96 | this.args = args; 97 | setAsParentNodeOf(this.args); 98 | } 99 | 100 | public void setExpr(final Expression expr) { 101 | this.expr = expr; 102 | setAsParentNodeOf(this.expr); 103 | } 104 | 105 | public void setThis(final boolean isThis) { 106 | this.isThis = isThis; 107 | } 108 | 109 | public void setTypeArgs(final List typeArgs) { 110 | this.typeArgs = typeArgs; 111 | setAsParentNodeOf(this.typeArgs); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ExpressionStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class ExpressionStmt extends Statement { 32 | 33 | private Expression expr; 34 | 35 | public ExpressionStmt() { 36 | } 37 | 38 | public ExpressionStmt(final Expression expr) { 39 | setExpression(expr); 40 | } 41 | 42 | public ExpressionStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final Expression expr) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | setExpression(expr); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public Expression getExpression() { 57 | return expr; 58 | } 59 | 60 | public void setExpression(final Expression expr) { 61 | this.expr = expr; 62 | setAsParentNodeOf(this.expr); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ForStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class ForStmt extends Statement { 36 | 37 | private List init; 38 | 39 | private Expression compare; 40 | 41 | private List update; 42 | 43 | private Statement body; 44 | 45 | public ForStmt() { 46 | } 47 | 48 | public ForStmt(final List init, final Expression compare, 49 | final List update, final Statement body) { 50 | setCompare(compare); 51 | setInit(init); 52 | setUpdate(update); 53 | setBody(body); 54 | } 55 | 56 | public ForStmt(final int beginLine, final int beginColumn, 57 | final int endLine, final int endColumn, 58 | final List init, final Expression compare, 59 | final List update, final Statement body) { 60 | super(beginLine, beginColumn, endLine, endColumn); 61 | setCompare(compare); 62 | setInit(init); 63 | setUpdate(update); 64 | setBody(body); 65 | } 66 | 67 | @Override 68 | public R accept(final GenericVisitor v, final A arg) { 69 | return v.visit(this, arg); 70 | } 71 | 72 | @Override 73 | public void accept(final VoidVisitor v, final A arg) { 74 | v.visit(this, arg); 75 | } 76 | 77 | public Statement getBody() { 78 | return body; 79 | } 80 | 81 | public Expression getCompare() { 82 | return compare; 83 | } 84 | 85 | public List getInit() { 86 | init = ensureNotNull(init); 87 | return init; 88 | } 89 | 90 | public List getUpdate() { 91 | update = ensureNotNull(update); 92 | return update; 93 | } 94 | 95 | public void setBody(final Statement body) { 96 | this.body = body; 97 | setAsParentNodeOf(this.body); 98 | } 99 | 100 | public void setCompare(final Expression compare) { 101 | this.compare = compare; 102 | setAsParentNodeOf(this.compare); 103 | } 104 | 105 | public void setInit(final List init) { 106 | this.init = init; 107 | setAsParentNodeOf(this.init); 108 | } 109 | 110 | public void setUpdate(final List update) { 111 | this.update = update; 112 | setAsParentNodeOf(this.update); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ForeachStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.expr.VariableDeclarationExpr; 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class ForeachStmt extends Statement { 33 | 34 | private VariableDeclarationExpr var; 35 | 36 | private Expression iterable; 37 | 38 | private Statement body; 39 | 40 | public ForeachStmt() { 41 | } 42 | 43 | public ForeachStmt(final VariableDeclarationExpr var, 44 | final Expression iterable, final Statement body) { 45 | setVariable(var); 46 | setIterable(iterable); 47 | setBody(body); 48 | } 49 | 50 | public ForeachStmt(final int beginLine, final int beginColumn, 51 | final int endLine, final int endColumn, 52 | final VariableDeclarationExpr var, final Expression iterable, 53 | final Statement body) { 54 | super(beginLine, beginColumn, endLine, endColumn); 55 | setVariable(var); 56 | setIterable(iterable); 57 | setBody(body); 58 | } 59 | 60 | @Override 61 | public R accept(final GenericVisitor v, final A arg) { 62 | return v.visit(this, arg); 63 | } 64 | 65 | @Override 66 | public void accept(final VoidVisitor v, final A arg) { 67 | v.visit(this, arg); 68 | } 69 | 70 | public Statement getBody() { 71 | return body; 72 | } 73 | 74 | public Expression getIterable() { 75 | return iterable; 76 | } 77 | 78 | public VariableDeclarationExpr getVariable() { 79 | return var; 80 | } 81 | 82 | public void setBody(final Statement body) { 83 | this.body = body; 84 | setAsParentNodeOf(this.body); 85 | } 86 | 87 | public void setIterable(final Expression iterable) { 88 | this.iterable = iterable; 89 | setAsParentNodeOf(this.iterable); 90 | } 91 | 92 | public void setVariable(final VariableDeclarationExpr var) { 93 | this.var = var; 94 | setAsParentNodeOf(this.var); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/IfStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class IfStmt extends Statement { 32 | 33 | private Expression condition; 34 | 35 | private Statement thenStmt; 36 | 37 | private Statement elseStmt; 38 | 39 | public IfStmt() { 40 | } 41 | 42 | public IfStmt(final Expression condition, final Statement thenStmt, final Statement elseStmt) { 43 | setCondition(condition); 44 | setThenStmt(thenStmt); 45 | setElseStmt(elseStmt); 46 | } 47 | 48 | public IfStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 49 | final Expression condition, final Statement thenStmt, final Statement elseStmt) { 50 | super(beginLine, beginColumn, endLine, endColumn); 51 | setCondition(condition); 52 | setThenStmt(thenStmt); 53 | setElseStmt(elseStmt); 54 | } 55 | 56 | @Override public R accept(final GenericVisitor v, final A arg) { 57 | return v.visit(this, arg); 58 | } 59 | 60 | @Override public void accept(final VoidVisitor v, final A arg) { 61 | v.visit(this, arg); 62 | } 63 | 64 | public Expression getCondition() { 65 | return condition; 66 | } 67 | 68 | public Statement getElseStmt() { 69 | return elseStmt; 70 | } 71 | 72 | public Statement getThenStmt() { 73 | return thenStmt; 74 | } 75 | 76 | public void setCondition(final Expression condition) { 77 | this.condition = condition; 78 | setAsParentNodeOf(this.condition); 79 | } 80 | 81 | public void setElseStmt(final Statement elseStmt) { 82 | this.elseStmt = elseStmt; 83 | setAsParentNodeOf(this.elseStmt); 84 | } 85 | 86 | public void setThenStmt(final Statement thenStmt) { 87 | this.thenStmt = thenStmt; 88 | setAsParentNodeOf(this.thenStmt); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/LabeledStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class LabeledStmt extends Statement { 31 | 32 | private String label; 33 | 34 | private Statement stmt; 35 | 36 | public LabeledStmt() { 37 | } 38 | 39 | public LabeledStmt(final String label, final Statement stmt) { 40 | setLabel(label); 41 | setStmt(stmt); 42 | } 43 | 44 | public LabeledStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 45 | final String label, final Statement stmt) { 46 | super(beginLine, beginColumn, endLine, endColumn); 47 | setLabel(label); 48 | setStmt(stmt); 49 | } 50 | 51 | @Override public R accept(final GenericVisitor v, final A arg) { 52 | return v.visit(this, arg); 53 | } 54 | 55 | @Override public void accept(final VoidVisitor v, final A arg) { 56 | v.visit(this, arg); 57 | } 58 | 59 | public String getLabel() { 60 | return label; 61 | } 62 | 63 | public Statement getStmt() { 64 | return stmt; 65 | } 66 | 67 | public void setLabel(final String label) { 68 | this.label = label; 69 | } 70 | 71 | public void setStmt(final Statement stmt) { 72 | this.stmt = stmt; 73 | setAsParentNodeOf(this.stmt); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ReturnStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class ReturnStmt extends Statement { 32 | 33 | private Expression expr; 34 | 35 | public ReturnStmt() { 36 | } 37 | 38 | public ReturnStmt(final Expression expr) { 39 | setExpr(expr); 40 | } 41 | 42 | public ReturnStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final Expression expr) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | setExpr(expr); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public Expression getExpr() { 57 | return expr; 58 | } 59 | 60 | public void setExpr(final Expression expr) { 61 | this.expr = expr; 62 | setAsParentNodeOf(this.expr); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/Statement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.Node; 25 | 26 | /** 27 | * @author Julio Vilmar Gesser 28 | */ 29 | public abstract class Statement extends Node { 30 | 31 | public Statement() { 32 | } 33 | 34 | public Statement(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 35 | super(beginLine, beginColumn, endLine, endColumn); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/SwitchEntryStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class SwitchEntryStmt extends Statement { 36 | 37 | private Expression label; 38 | 39 | private List stmts; 40 | 41 | public SwitchEntryStmt() { 42 | } 43 | 44 | public SwitchEntryStmt(final Expression label, final List stmts) { 45 | setLabel(label); 46 | setStmts(stmts); 47 | } 48 | 49 | public SwitchEntryStmt(final int beginLine, final int beginColumn, 50 | final int endLine, final int endColumn, final Expression label, 51 | final List stmts) { 52 | super(beginLine, beginColumn, endLine, endColumn); 53 | setLabel(label); 54 | setStmts(stmts); 55 | } 56 | 57 | @Override 58 | public R accept(final GenericVisitor v, final A arg) { 59 | return v.visit(this, arg); 60 | } 61 | 62 | @Override 63 | public void accept(final VoidVisitor v, final A arg) { 64 | v.visit(this, arg); 65 | } 66 | 67 | public Expression getLabel() { 68 | return label; 69 | } 70 | 71 | public List getStmts() { 72 | stmts = ensureNotNull(stmts); 73 | return stmts; 74 | } 75 | 76 | public void setLabel(final Expression label) { 77 | this.label = label; 78 | setAsParentNodeOf(this.label); 79 | } 80 | 81 | public void setStmts(final List stmts) { 82 | this.stmts = stmts; 83 | setAsParentNodeOf(this.stmts); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/SwitchStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class SwitchStmt extends Statement { 36 | 37 | private Expression selector; 38 | 39 | private List entries; 40 | 41 | public SwitchStmt() { 42 | } 43 | 44 | public SwitchStmt(final Expression selector, 45 | final List entries) { 46 | setSelector(selector); 47 | setEntries(entries); 48 | } 49 | 50 | public SwitchStmt(final int beginLine, final int beginColumn, 51 | final int endLine, final int endColumn, final Expression selector, 52 | final List entries) { 53 | super(beginLine, beginColumn, endLine, endColumn); 54 | setSelector(selector); 55 | setEntries(entries); 56 | } 57 | 58 | @Override 59 | public R accept(final GenericVisitor v, final A arg) { 60 | return v.visit(this, arg); 61 | } 62 | 63 | @Override 64 | public void accept(final VoidVisitor v, final A arg) { 65 | v.visit(this, arg); 66 | } 67 | 68 | public List getEntries() { 69 | entries = ensureNotNull(entries); 70 | return entries; 71 | } 72 | 73 | public Expression getSelector() { 74 | return selector; 75 | } 76 | 77 | public void setEntries(final List entries) { 78 | this.entries = entries; 79 | setAsParentNodeOf(this.entries); 80 | } 81 | 82 | public void setSelector(final Expression selector) { 83 | this.selector = selector; 84 | setAsParentNodeOf(this.selector); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/SynchronizedStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class SynchronizedStmt extends Statement { 32 | 33 | private Expression expr; 34 | 35 | private BlockStmt block; 36 | 37 | public SynchronizedStmt() { 38 | } 39 | 40 | public SynchronizedStmt(final Expression expr, final BlockStmt block) { 41 | setExpr(expr); 42 | setBlock(block); 43 | } 44 | 45 | public SynchronizedStmt(final int beginLine, final int beginColumn, 46 | final int endLine, final int endColumn, final Expression expr, 47 | final BlockStmt block) { 48 | super(beginLine, beginColumn, endLine, endColumn); 49 | setExpr(expr); 50 | setBlock(block); 51 | } 52 | 53 | @Override 54 | public R accept(final GenericVisitor v, final A arg) { 55 | return v.visit(this, arg); 56 | } 57 | 58 | @Override 59 | public void accept(final VoidVisitor v, final A arg) { 60 | v.visit(this, arg); 61 | } 62 | 63 | public BlockStmt getBlock() { 64 | return block; 65 | } 66 | 67 | public Expression getExpr() { 68 | return expr; 69 | } 70 | 71 | public void setBlock(final BlockStmt block) { 72 | this.block = block; 73 | setAsParentNodeOf(this.block); 74 | } 75 | 76 | public void setExpr(final Expression expr) { 77 | this.expr = expr; 78 | setAsParentNodeOf(this.expr); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/ThrowStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class ThrowStmt extends Statement { 32 | 33 | private Expression expr; 34 | 35 | public ThrowStmt() { 36 | } 37 | 38 | public ThrowStmt(final Expression expr) { 39 | setExpr(expr); 40 | } 41 | 42 | public ThrowStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final Expression expr) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | setExpr(expr); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public Expression getExpr() { 57 | return expr; 58 | } 59 | 60 | public void setExpr(final Expression expr) { 61 | this.expr = expr; 62 | setAsParentNodeOf(this.expr); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/TryStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | import com.github.javaparser.ast.expr.VariableDeclarationExpr; 27 | 28 | import java.util.List; 29 | 30 | import static com.github.javaparser.ast.internal.Utils.*; 31 | 32 | /** 33 | * @author Julio Vilmar Gesser 34 | */ 35 | public final class TryStmt extends Statement { 36 | 37 | private List resources; 38 | 39 | private BlockStmt tryBlock; 40 | 41 | private List catchs; 42 | 43 | private BlockStmt finallyBlock; 44 | 45 | public TryStmt() { 46 | } 47 | 48 | public TryStmt(final BlockStmt tryBlock, final List catchs, 49 | final BlockStmt finallyBlock) { 50 | setTryBlock(tryBlock); 51 | setCatchs(catchs); 52 | setFinallyBlock(finallyBlock); 53 | } 54 | 55 | public TryStmt(final int beginLine, final int beginColumn, 56 | final int endLine, final int endColumn, List resources, 57 | final BlockStmt tryBlock, final List catchs, final BlockStmt finallyBlock) { 58 | super(beginLine, beginColumn, endLine, endColumn); 59 | setResources(resources); 60 | setTryBlock(tryBlock); 61 | setCatchs(catchs); 62 | setFinallyBlock(finallyBlock); 63 | } 64 | 65 | @Override 66 | public R accept(final GenericVisitor v, final A arg) { 67 | return v.visit(this, arg); 68 | } 69 | 70 | @Override 71 | public void accept(final VoidVisitor v, final A arg) { 72 | v.visit(this, arg); 73 | } 74 | 75 | public List getCatchs() { 76 | catchs = ensureNotNull(catchs); 77 | return catchs; 78 | } 79 | 80 | public BlockStmt getFinallyBlock() { 81 | return finallyBlock; 82 | } 83 | 84 | public BlockStmt getTryBlock() { 85 | return tryBlock; 86 | } 87 | 88 | public List getResources() { 89 | resources = ensureNotNull(resources); 90 | return resources; 91 | } 92 | 93 | public void setCatchs(final List catchs) { 94 | this.catchs = catchs; 95 | setAsParentNodeOf(this.catchs); 96 | } 97 | 98 | public void setFinallyBlock(final BlockStmt finallyBlock) { 99 | this.finallyBlock = finallyBlock; 100 | setAsParentNodeOf(this.finallyBlock); 101 | } 102 | 103 | public void setTryBlock(final BlockStmt tryBlock) { 104 | this.tryBlock = tryBlock; 105 | setAsParentNodeOf(this.tryBlock); 106 | } 107 | 108 | public void setResources(List resources) { 109 | this.resources = resources; 110 | setAsParentNodeOf(this.resources); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.body.TypeDeclaration; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class TypeDeclarationStmt extends Statement { 32 | 33 | private TypeDeclaration typeDecl; 34 | 35 | public TypeDeclarationStmt() { 36 | } 37 | 38 | public TypeDeclarationStmt(final TypeDeclaration typeDecl) { 39 | setTypeDeclaration(typeDecl); 40 | } 41 | 42 | public TypeDeclarationStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 43 | final TypeDeclaration typeDecl) { 44 | super(beginLine, beginColumn, endLine, endColumn); 45 | setTypeDeclaration(typeDecl); 46 | } 47 | 48 | @Override public R accept(final GenericVisitor v, final A arg) { 49 | return v.visit(this, arg); 50 | } 51 | 52 | @Override public void accept(final VoidVisitor v, final A arg) { 53 | v.visit(this, arg); 54 | } 55 | 56 | public TypeDeclaration getTypeDeclaration() { 57 | return typeDecl; 58 | } 59 | 60 | public void setTypeDeclaration(final TypeDeclaration typeDecl) { 61 | this.typeDecl = typeDecl; 62 | setAsParentNodeOf(this.typeDecl); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/stmt/WhileStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.stmt; 23 | 24 | import com.github.javaparser.ast.expr.Expression; 25 | import com.github.javaparser.ast.visitor.GenericVisitor; 26 | import com.github.javaparser.ast.visitor.VoidVisitor; 27 | 28 | /** 29 | * @author Julio Vilmar Gesser 30 | */ 31 | public final class WhileStmt extends Statement { 32 | 33 | private Expression condition; 34 | 35 | private Statement body; 36 | 37 | public WhileStmt() { 38 | } 39 | 40 | public WhileStmt(final Expression condition, final Statement body) { 41 | setCondition(condition); 42 | setBody(body); 43 | } 44 | 45 | public WhileStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 46 | final Expression condition, final Statement body) { 47 | super(beginLine, beginColumn, endLine, endColumn); 48 | setCondition(condition); 49 | setBody(body); 50 | } 51 | 52 | @Override public R accept(final GenericVisitor v, final A arg) { 53 | return v.visit(this, arg); 54 | } 55 | 56 | @Override public void accept(final VoidVisitor v, final A arg) { 57 | v.visit(this, arg); 58 | } 59 | 60 | public Statement getBody() { 61 | return body; 62 | } 63 | 64 | public Expression getCondition() { 65 | return condition; 66 | } 67 | 68 | public void setBody(final Statement body) { 69 | this.body = body; 70 | setAsParentNodeOf(this.body); 71 | } 72 | 73 | public void setCondition(final Expression condition) { 74 | this.condition = condition; 75 | setAsParentNodeOf(this.condition); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/IntersectionType.java: -------------------------------------------------------------------------------- 1 | package com.github.javaparser.ast.type; 2 | 3 | import com.github.javaparser.ast.expr.AnnotationExpr; 4 | import com.github.javaparser.ast.visitor.GenericVisitor; 5 | import com.github.javaparser.ast.visitor.VoidVisitor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Represents a set of types. A given value of this type has to be assignable to at all of the element types. 11 | * As of Java 8 it is used in casts or while expressing bounds for generic types. 12 | * 13 | * For example: 14 | * public class A>T extends Serializable & Cloneable< { } 15 | * 16 | * Or: 17 | * void foo((Serializable & Cloneable)myObject); 18 | * 19 | * @since 3.0.0 20 | */ 21 | public class IntersectionType extends Type { 22 | 23 | private List elements; 24 | 25 | public IntersectionType(int beginLine, int beginColumn, int endLine, 26 | int endColumn, List elements) { 27 | super(beginLine, beginColumn, endLine, endColumn); 28 | setElements(elements); 29 | } 30 | 31 | public IntersectionType(List elements) { 32 | super(); 33 | setElements(elements); 34 | } 35 | 36 | @Override 37 | public R accept(GenericVisitor v, A arg) { 38 | return v.visit(this, arg); 39 | } 40 | 41 | @Override 42 | public void accept(VoidVisitor v, A arg) { 43 | v.visit(this, arg); 44 | } 45 | 46 | public List getElements() { 47 | return elements; 48 | } 49 | 50 | public void setElements(List elements) { 51 | if (this.elements != null) { 52 | for (ReferenceType element : elements){ 53 | element.setParentNode(null); 54 | } 55 | } 56 | this.elements = elements; 57 | setAsParentNodeOf(this.elements); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/PrimitiveType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.type; 23 | 24 | import java.util.HashMap; 25 | 26 | import com.github.javaparser.ast.visitor.GenericVisitor; 27 | import com.github.javaparser.ast.visitor.VoidVisitor; 28 | 29 | /** 30 | * @author Julio Vilmar Gesser 31 | */ 32 | public final class PrimitiveType extends Type { 33 | 34 | public enum Primitive { 35 | Boolean ("Boolean"), 36 | Char ("Character"), 37 | Byte ("Byte"), 38 | Short ("Short"), 39 | Int ("Integer"), 40 | Long ("Long"), 41 | Float ("Float"), 42 | Double ("Double"); 43 | 44 | final String nameOfBoxedType; 45 | 46 | public ClassOrInterfaceType toBoxedType() { 47 | return new ClassOrInterfaceType(nameOfBoxedType); 48 | } 49 | 50 | private Primitive(String nameOfBoxedType) { 51 | this.nameOfBoxedType = nameOfBoxedType; 52 | } 53 | } 54 | 55 | static final HashMap unboxMap = new HashMap(); 56 | static { 57 | for(Primitive unboxedType : Primitive.values()) { 58 | unboxMap.put(unboxedType.nameOfBoxedType, unboxedType); 59 | } 60 | } 61 | 62 | private Primitive type; 63 | 64 | public PrimitiveType() { 65 | } 66 | 67 | public PrimitiveType(final Primitive type) { 68 | this.type = type; 69 | } 70 | 71 | public PrimitiveType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 72 | final Primitive type) { 73 | super(beginLine, beginColumn, endLine, endColumn); 74 | this.type = type; 75 | } 76 | 77 | @Override public R accept(final GenericVisitor v, final A arg) { 78 | return v.visit(this, arg); 79 | } 80 | 81 | @Override public void accept(final VoidVisitor v, final A arg) { 82 | v.visit(this, arg); 83 | } 84 | 85 | public Primitive getType() { 86 | return type; 87 | } 88 | 89 | public ClassOrInterfaceType toBoxedType() { 90 | return type.toBoxedType(); 91 | } 92 | 93 | public void setType(final Primitive type) { 94 | this.type = type; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/Type.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.type; 23 | 24 | import com.github.javaparser.ast.Node; 25 | import com.github.javaparser.ast.expr.AnnotationExpr; 26 | 27 | import java.util.List; 28 | 29 | import static com.github.javaparser.ast.internal.Utils.*; 30 | 31 | /** 32 | * @author Julio Vilmar Gesser 33 | */ 34 | public abstract class Type extends Node { 35 | 36 | private List annotations; 37 | 38 | public Type() { 39 | } 40 | 41 | public Type(List annotation){ 42 | this.annotations = annotation; 43 | } 44 | 45 | public Type(int beginLine, int beginColumn, int endLine, int endColumn) { 46 | super(beginLine, beginColumn, endLine, endColumn); 47 | } 48 | 49 | public Type(int beginLine, int beginColumn, int endLine, int endColumn, List annotations) { 50 | super(beginLine, beginColumn, endLine, endColumn); 51 | this.annotations = annotations; 52 | } 53 | 54 | public List getAnnotations() { 55 | annotations = ensureNotNull(annotations); 56 | return annotations; 57 | } 58 | 59 | public void setAnnotations(List annotations) { 60 | this.annotations = annotations; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/UnionType.java: -------------------------------------------------------------------------------- 1 | package com.github.javaparser.ast.type; 2 | 3 | import com.github.javaparser.ast.visitor.GenericVisitor; 4 | import com.github.javaparser.ast.visitor.VoidVisitor; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Represents a set of types. A given value of this type has to be assignable to at least one of the element types. 10 | * As of Java 8 it is only used in catch clauses. 11 | * 12 | * @since 3.0.0 13 | */ 14 | public class UnionType extends Type { 15 | 16 | private List elements; 17 | 18 | public UnionType(int beginLine, int beginColumn, int endLine, 19 | int endColumn, List elements) { 20 | super(beginLine, beginColumn, endLine, endColumn); 21 | setElements(elements); 22 | } 23 | 24 | public UnionType(List elements) { 25 | super(); 26 | setElements(elements); 27 | } 28 | 29 | public List getElements() { 30 | return elements; 31 | } 32 | 33 | public void setElements(List elements) { 34 | if (this.elements != null) { 35 | for (ReferenceType element : elements){ 36 | element.setParentNode(null); 37 | } 38 | } 39 | this.elements = elements; 40 | setAsParentNodeOf(this.elements); 41 | } 42 | 43 | @Override 44 | public R accept(GenericVisitor v, A arg) { 45 | return v.visit(this, arg); 46 | } 47 | 48 | @Override 49 | public void accept(VoidVisitor v, A arg) { 50 | v.visit(this, arg); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/UnknownType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.type; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * An unknown parameter type object. It plays the role of a null object for 29 | * lambda parameters that have no explicit type declared. As such, it has no 30 | * lexical representation and hence gets no comment attributed. 31 | * 32 | * @author Didier Villevalois 33 | */ 34 | public final class UnknownType extends Type { 35 | 36 | public UnknownType() { 37 | } 38 | 39 | @Override 40 | public R accept(final GenericVisitor v, final A arg) { 41 | return v.visit(this, arg); 42 | } 43 | 44 | @Override 45 | public void accept(final VoidVisitor v, final A arg) { 46 | v.visit(this, arg); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/VoidType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.type; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class VoidType extends Type { 31 | 32 | public VoidType() { 33 | } 34 | 35 | public VoidType(final int beginLine, final int beginColumn, final int endLine, final int endColumn) { 36 | super(beginLine, beginColumn, endLine, endColumn); 37 | } 38 | 39 | @Override public R accept(final GenericVisitor v, final A arg) { 40 | return v.visit(this, arg); 41 | } 42 | 43 | @Override public void accept(final VoidVisitor v, final A arg) { 44 | v.visit(this, arg); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /source_to_parse/com/github/javaparser/ast/type/WildcardType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2010 Júlio Vilmar Gesser. 3 | * Copyright (C) 2011, 2013-2015 The JavaParser Team. 4 | * 5 | * This file is part of JavaParser. 6 | * 7 | * JavaParser can be used either under the terms of 8 | * a) the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * b) the terms of the Apache License 12 | * 13 | * You should have received a copy of both licenses in LICENCE.LGPL and 14 | * LICENCE.APACHE. Please refer to those files for details. 15 | * 16 | * JavaParser is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | */ 21 | 22 | package com.github.javaparser.ast.type; 23 | 24 | import com.github.javaparser.ast.visitor.GenericVisitor; 25 | import com.github.javaparser.ast.visitor.VoidVisitor; 26 | 27 | /** 28 | * @author Julio Vilmar Gesser 29 | */ 30 | public final class WildcardType extends Type { 31 | 32 | private ReferenceType ext; 33 | 34 | private ReferenceType sup; 35 | 36 | public WildcardType() { 37 | } 38 | 39 | public WildcardType(final ReferenceType ext) { 40 | setExtends(ext); 41 | } 42 | 43 | public WildcardType(final ReferenceType ext, final ReferenceType sup) { 44 | setExtends(ext); 45 | setSuper(sup); 46 | } 47 | 48 | public WildcardType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, 49 | final ReferenceType ext, final ReferenceType sup) { 50 | super(beginLine, beginColumn, endLine, endColumn); 51 | setExtends(ext); 52 | setSuper(sup); 53 | } 54 | 55 | @Override public R accept(final GenericVisitor v, final A arg) { 56 | return v.visit(this, arg); 57 | } 58 | 59 | @Override public void accept(final VoidVisitor v, final A arg) { 60 | v.visit(this, arg); 61 | } 62 | 63 | public ReferenceType getExtends() { 64 | return ext; 65 | } 66 | 67 | public ReferenceType getSuper() { 68 | return sup; 69 | } 70 | 71 | public void setExtends(final ReferenceType ext) { 72 | this.ext = ext; 73 | setAsParentNodeOf(this.ext); 74 | } 75 | 76 | public void setSuper(final ReferenceType sup) { 77 | this.sup = sup; 78 | setAsParentNodeOf(this.sup); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/me/tomassetti/javadocextractor/AllJavadocExtractor.java: -------------------------------------------------------------------------------- 1 | package me.tomassetti.javadocextractor; 2 | 3 | import com.github.javaparser.JavaParser; 4 | import com.github.javaparser.ast.Node; 5 | import com.github.javaparser.ast.body.*; 6 | import com.github.javaparser.ast.comments.JavadocComment; 7 | import com.github.javaparser.ast.visitor.VoidVisitorAdapter; 8 | import com.google.common.base.Strings; 9 | import me.tomassetti.javadocextractor.support.DirExplorer; 10 | 11 | import java.io.File; 12 | import java.io.IOException; 13 | import java.util.List; 14 | import java.util.stream.Collector; 15 | import java.util.stream.Collectors; 16 | 17 | /** 18 | * Iterate over all the Javadoc comments and print them together with a description of the commented element. 19 | */ 20 | public class AllJavadocExtractor { 21 | 22 | public static void main(String[] args) { 23 | File projectDir = new File("source_to_parse/"); 24 | new DirExplorer((level, path, file) -> path.endsWith(".java"), (level, path, file) -> { 25 | try { 26 | new VoidVisitorAdapter() { 27 | @Override 28 | public void visit(JavadocComment comment, Object arg) { 29 | super.visit(comment, arg); 30 | String title = null; 31 | if (comment.getCommentedNode().isPresent()) { 32 | title = String.format("%s (%s)", describe(comment.getCommentedNode().get()), path); 33 | } else { 34 | title = String.format("No element associated (%s)", path); 35 | } 36 | System.out.println(title); 37 | System.out.println(Strings.repeat("=", title.length())); 38 | System.out.println(comment); 39 | } 40 | }.visit(JavaParser.parse(file), null); 41 | } catch (IOException e) { 42 | new RuntimeException(e); 43 | } 44 | }).explore(projectDir); 45 | } 46 | 47 | private static String describe(Node node) { 48 | if (node instanceof MethodDeclaration) { 49 | MethodDeclaration methodDeclaration = (MethodDeclaration)node; 50 | return "Method " + methodDeclaration.getDeclarationAsString(); 51 | } 52 | if (node instanceof ConstructorDeclaration) { 53 | ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration)node; 54 | return "Constructor " + constructorDeclaration.getDeclarationAsString(); 55 | } 56 | if (node instanceof ClassOrInterfaceDeclaration) { 57 | ClassOrInterfaceDeclaration classOrInterfaceDeclaration = (ClassOrInterfaceDeclaration)node; 58 | if (classOrInterfaceDeclaration.isInterface()) { 59 | return "Interface " + classOrInterfaceDeclaration.getName(); 60 | } else { 61 | return "Class " + classOrInterfaceDeclaration.getName(); 62 | } 63 | } 64 | if (node instanceof EnumDeclaration) { 65 | EnumDeclaration enumDeclaration = (EnumDeclaration)node; 66 | return "Enum " + enumDeclaration.getName(); 67 | } 68 | if (node instanceof FieldDeclaration) { 69 | FieldDeclaration fieldDeclaration = (FieldDeclaration)node; 70 | List varNames = fieldDeclaration.getVariables().stream().map(v -> v.getName().getId()).collect(Collectors.toList()); 71 | return "Field " + String.join(", ", varNames); 72 | } 73 | return node.toString(); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/me/tomassetti/javadocextractor/ClassesJavadocExtractor.java: -------------------------------------------------------------------------------- 1 | package me.tomassetti.javadocextractor; 2 | 3 | import com.github.javaparser.JavaParser; 4 | import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; 5 | import com.github.javaparser.ast.comments.JavadocComment; 6 | import com.github.javaparser.ast.visitor.VoidVisitorAdapter; 7 | import com.google.common.base.Strings; 8 | import me.tomassetti.javadocextractor.support.DirExplorer; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | 13 | /** 14 | * Iterate over the classes and print their Javadoc. 15 | */ 16 | public class ClassesJavadocExtractor { 17 | 18 | public static void main(String[] args) { 19 | File projectDir = new File("source_to_parse/"); 20 | new DirExplorer((level, path, file) -> path.endsWith(".java"), (level, path, file) -> { 21 | try { 22 | new VoidVisitorAdapter() { 23 | @Override 24 | public void visit(ClassOrInterfaceDeclaration n, Object arg) { 25 | super.visit(n, arg); 26 | if (n.getComment() != null && n.getComment() instanceof JavadocComment) { 27 | String title = String.format("%s (%s)", n.getName(), path); 28 | System.out.println(title); 29 | System.out.println(Strings.repeat("=", title.length())); 30 | System.out.println(n.getComment()); 31 | } 32 | } 33 | }.visit(JavaParser.parse(file), null); 34 | } catch (IOException e) { 35 | new RuntimeException(e); 36 | } 37 | }).explore(projectDir); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/me/tomassetti/javadocextractor/support/DirExplorer.java: -------------------------------------------------------------------------------- 1 | package me.tomassetti.javadocextractor.support; 2 | 3 | import java.io.File; 4 | 5 | public class DirExplorer { 6 | public interface FileHandler { 7 | void handle(int level, String path, File file); 8 | } 9 | 10 | public interface Filter { 11 | boolean interested(int level, String path, File file); 12 | } 13 | 14 | private FileHandler fileHandler; 15 | private Filter filter; 16 | 17 | public DirExplorer(Filter filter, FileHandler fileHandler) { 18 | this.filter = filter; 19 | this.fileHandler = fileHandler; 20 | } 21 | 22 | public void explore(File root) { 23 | explore(0, "", root); 24 | } 25 | 26 | private void explore(int level, String path, File file) { 27 | if (file.isDirectory()) { 28 | for (File child : file.listFiles()) { 29 | explore(level + 1, path + "/" + child.getName(), child); 30 | } 31 | } else { 32 | if (filter.interested(level, path, file)) { 33 | fileHandler.handle(level, path, file); 34 | } 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/me/tomassetti/javadocextractor/support/NodeIterator.java: -------------------------------------------------------------------------------- 1 | package me.tomassetti.javadocextractor.support; 2 | 3 | import com.github.javaparser.ast.Node; 4 | 5 | public class NodeIterator { 6 | public interface NodeHandler { 7 | boolean handle(Node node); 8 | } 9 | 10 | private NodeHandler nodeHandler; 11 | 12 | public NodeIterator(NodeHandler nodeHandler) { 13 | this.nodeHandler = nodeHandler; 14 | } 15 | 16 | public void explore(Node node) { 17 | if (nodeHandler.handle(node)) { 18 | for (Node child : node.getChildNodes()) { 19 | explore(child); 20 | } 21 | } 22 | } 23 | } 24 | --------------------------------------------------------------------------------