From 53c1e079e4d6826864fe0c4285b4ea14888b83ce Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Wed, 11 Sep 2024 10:56:52 +0200 Subject: [PATCH] Add current state of generated Java model and visitor Still has some issues here and there. --- openrewrite/src/java/extensions.ts | 27 +- openrewrite/src/java/support_types.ts | 248 +- openrewrite/src/java/tree.ts | 6046 +++++++++++++++++++++++++ openrewrite/src/java/visitor.ts | 984 ++++ 4 files changed, 7303 insertions(+), 2 deletions(-) create mode 100644 openrewrite/src/java/tree.ts create mode 100644 openrewrite/src/java/visitor.ts diff --git a/openrewrite/src/java/extensions.ts b/openrewrite/src/java/extensions.ts index 336ce12b..4906738b 100644 --- a/openrewrite/src/java/extensions.ts +++ b/openrewrite/src/java/extensions.ts @@ -1 +1,26 @@ -export {} +import {JavaVisitor} from "./visitor"; +import { + JContainer, + JContainerLocation, + JLeftPadded, + JLeftPaddedLocation, + JRightPadded, JRightPaddedLocation, + Space, + SpaceLocation +} from "./support_types"; + +export function visitSpace

(v: JavaVisitor

, space: Space | null, loc: SpaceLocation, p: P): Space { + return space!; +} + +export function visitContainer(v: JavaVisitor

, container: JContainer | null, loc: JContainerLocation, p: P) { + return container!; +} + +export function visitLeftPadded(v: JavaVisitor

, left: JLeftPadded | null, loc: JLeftPaddedLocation, p: P) { + return left!; +} + +export function visitRightPadded(v: JavaVisitor

, right: JRightPadded | null, loc: JRightPaddedLocation, p: P) { + return right!; +} diff --git a/openrewrite/src/java/support_types.ts b/openrewrite/src/java/support_types.ts index e75a9c93..44b3ed68 100644 --- a/openrewrite/src/java/support_types.ts +++ b/openrewrite/src/java/support_types.ts @@ -44,12 +44,212 @@ export interface TypedTree extends Tree { withType(type: JavaType | null): TypedTree; } +export enum SpaceLocation { + ANY, + ANNOTATED_TYPE_PREFIX, + ANNOTATION_ARGUMENTS, + ANNOTATION_ARGUMENT_SUFFIX, + ANNOTATIONS, + ANNOTATION_PREFIX, + ARRAY_ACCESS_PREFIX, + ARRAY_INDEX_SUFFIX, + ARRAY_TYPE_PREFIX, + ASSERT_PREFIX, + ASSERT_DETAIL, + ASSERT_DETAIL_PREFIX, + ASSIGNMENT, + ASSIGNMENT_OPERATION_PREFIX, + ASSIGNMENT_OPERATION_OPERATOR, + ASSIGNMENT_PREFIX, + BINARY_OPERATOR, + BINARY_PREFIX, + BLOCK_END, + BLOCK_PREFIX, + BLOCK_STATEMENT_SUFFIX, + BREAK_PREFIX, + CASE, + CASE_PREFIX, + CASE_BODY, + CASE_EXPRESSION, + CASE_SUFFIX, + CATCH_ALTERNATIVE_SUFFIX, + CATCH_PREFIX, + CLASS_DECLARATION_PREFIX, + CLASS_KIND, + COMPILATION_UNIT_EOF, + COMPILATION_UNIT_PREFIX, + CONTINUE_PREFIX, + CONTROL_PARENTHESES_PREFIX, + DIMENSION_PREFIX, + DIMENSION, + DIMENSION_SUFFIX, + DO_WHILE_PREFIX, + ELSE_PREFIX, + EMPTY_PREFIX, + ENUM_VALUE_PREFIX, + ENUM_VALUE_SET_PREFIX, + ENUM_VALUE_SUFFIX, + EXPRESSION_PREFIX, + EXTENDS, + FIELD_ACCESS_NAME, + FIELD_ACCESS_PREFIX, + FOREACH_ITERABLE_SUFFIX, + FOREACH_VARIABLE_SUFFIX, + FOR_BODY_SUFFIX, + FOR_CONDITION_SUFFIX, + FOR_CONTROL_PREFIX, + FOR_EACH_CONTROL_PREFIX, + FOR_EACH_LOOP_PREFIX, + FOR_INIT_SUFFIX, + FOR_PREFIX, + FOR_UPDATE_SUFFIX, + IDENTIFIER_PREFIX, + IF_ELSE_SUFFIX, + IF_PREFIX, + IF_THEN_SUFFIX, + IMPLEMENTS, + IMPORT_ALIAS_PREFIX, + PERMITS, + IMPLEMENTS_SUFFIX, + IMPORT_PREFIX, + IMPORT_SUFFIX, + INSTANCEOF_PREFIX, + INSTANCEOF_SUFFIX, + INTERSECTION_TYPE_PREFIX, + LABEL_PREFIX, + LABEL_SUFFIX, + LAMBDA_ARROW_PREFIX, + LAMBDA_PARAMETER, + LAMBDA_PARAMETERS_PREFIX, + LAMBDA_PREFIX, + LANGUAGE_EXTENSION, + LITERAL_PREFIX, + MEMBER_REFERENCE_CONTAINING, + MEMBER_REFERENCE_NAME, + MEMBER_REFERENCE_PREFIX, + METHOD_DECLARATION_PARAMETERS, + METHOD_DECLARATION_PARAMETER_SUFFIX, + METHOD_DECLARATION_DEFAULT_VALUE, + METHOD_DECLARATION_PREFIX, + METHOD_INVOCATION_ARGUMENTS, + METHOD_INVOCATION_ARGUMENT_SUFFIX, + METHOD_INVOCATION_NAME, + METHOD_INVOCATION_PREFIX, + METHOD_SELECT_SUFFIX, + MODIFIER_PREFIX, + MULTI_CATCH_PREFIX, + NAMED_VARIABLE_SUFFIX, + NEW_ARRAY_INITIALIZER, + NEW_ARRAY_INITIALIZER_SUFFIX, + NEW_ARRAY_PREFIX, + NEW_CLASS_ARGUMENTS, + NEW_CLASS_ARGUMENTS_SUFFIX, + NEW_CLASS_ENCLOSING_SUFFIX, + NEW_CLASS_PREFIX, + NEW_PREFIX, + NULLABLE_TYPE_PREFIX, + NULLABLE_TYPE_SUFFIX, + PACKAGE_PREFIX, + PACKAGE_SUFFIX, + PARAMETERIZED_TYPE_PREFIX, + PARENTHESES_PREFIX, + PARENTHESES_SUFFIX, + PERMITS_SUFFIX, + PRIMITIVE_PREFIX, + RECORD_STATE_VECTOR, + RECORD_STATE_VECTOR_SUFFIX, + RETURN_PREFIX, + STATEMENT_PREFIX, + STATIC_IMPORT, + STATIC_INIT_SUFFIX, + SWITCH_PREFIX, + SWITCH_EXPRESSION_PREFIX, + SYNCHRONIZED_PREFIX, + TERNARY_FALSE, + TERNARY_PREFIX, + TERNARY_TRUE, + THROWS, + THROWS_SUFFIX, + THROW_PREFIX, + TRY_FINALLY, + TRY_PREFIX, + TRY_RESOURCE, + TRY_RESOURCES, + TRY_RESOURCE_SUFFIX, + TYPE_BOUNDS, + TYPE_BOUND_SUFFIX, + TYPE_CAST_PREFIX, + TYPE_PARAMETERS, + TYPE_PARAMETERS_PREFIX, + TYPE_PARAMETER_SUFFIX, + UNARY_OPERATOR, + UNARY_PREFIX, + UNKNOWN_PREFIX, + UNKNOWN_SOURCE_PREFIX, + VARARGS, + VARIABLE_DECLARATIONS_PREFIX, + VARIABLE_INITIALIZER, + VARIABLE_PREFIX, + WHILE_BODY_SUFFIX, + WHILE_CONDITION, + WHILE_PREFIX, + WILDCARD_BOUND, + WILDCARD_PREFIX, + YIELD_PREFIX, +} + export class Space { } export class Comment { } +export enum JRightPaddedLocation { + ANNOTATION_ARGUMENT, + ARRAY_INDEX, + BLOCK_STATEMENT, + CASE, + CASE_BODY, + CASE_EXPRESSION, + CATCH_ALTERNATIVE, + CONTROL_PARENTHESES_TREE, + DIMENSION, + ENUM_VALUE, + FOREACH_ITERABLE, + FOREACH_VARIABLE, + FOR_BODY, + FOR_CONDITION, + FOR_INIT, + FOR_UPDATE, + IF_ELSE, + IF_THEN, + IMPLEMENTS, + IMPORT, + INSTANCEOF, + LABEL, + LAMBDA_PARAM, + LANGUAGE_EXTENSION, + MEMBER_REFERENCE_CONTAINING, + METHOD_DECLARATION_PARAMETER, + METHOD_INVOCATION_ARGUMENT, + METHOD_SELECT, + NAMED_VARIABLE, + NEW_ARRAY_INITIALIZER, + NEW_CLASS_ARGUMENTS, + NEW_CLASS_ENCLOSING, + NULLABLE, + PACKAGE, + PARENTHESES, + PERMITS, + RECORD_STATE_VECTOR, + STATIC_INIT, + THROWS, + TRY_RESOURCE, + TYPE_BOUND, + TYPE_PARAMETER, + WHILE_BODY, +} + export class JRightPadded { constructor(element: T) { this._element = element; @@ -70,6 +270,52 @@ export class JRightPadded { } static withElement(padded: JRightPadded | null, element: T | null): JRightPadded { - return padded; + return padded!; } } + +export enum JLeftPaddedLocation { + ASSERT_DETAIL, + ASSIGNMENT, + ASSIGNMENT_OPERATION_OPERATOR, + BINARY_OPERATOR, + CLASS_KIND, + EXTENDS, + FIELD_ACCESS_NAME, + IMPORT_ALIAS_PREFIX, + LANGUAGE_EXTENSION, + MEMBER_REFERENCE_NAME, + METHOD_DECLARATION_DEFAULT_VALUE, + STATIC_IMPORT, + TERNARY_TRUE, + TERNARY_FALSE, + TRY_FINALLY, + UNARY_OPERATOR, + VARIABLE_INITIALIZER, + WHILE_CONDITION, + WILDCARD_BOUND, +} + +export class JLeftPadded { +} + +export enum JContainerLocation { + ANNOTATION_ARGUMENTS, + CASE, + CASE_EXPRESSION, + IMPLEMENTS, + PERMITS, + LANGUAGE_EXTENSION, + METHOD_DECLARATION_PARAMETERS, + METHOD_INVOCATION_ARGUMENTS, + NEW_ARRAY_INITIALIZER, + NEW_CLASS_ARGUMENTS, + RECORD_STATE_VECTOR, + THROWS, + TRY_RESOURCES, + TYPE_BOUNDS, + TYPE_PARAMETERS, +} + +export class JContainer { +} diff --git a/openrewrite/src/java/tree.ts b/openrewrite/src/java/tree.ts new file mode 100644 index 00000000..7fb2abda --- /dev/null +++ b/openrewrite/src/java/tree.ts @@ -0,0 +1,6046 @@ +// noinspection JSUnusedGlobalSymbols + +import * as extensions from "./extensions"; +import {Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, J} from "./support_types"; +import {JavaVisitor} from "./visitor"; +import {UUID, Checksum, FileAttributes, SourceFile, Tree, TreeVisitor, Markers, Cursor, PrintOutputCapture, PrinterFactory} from "../core"; + +export class AnnotatedType extends J implements Expression, TypeTree { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], typeExpression: TypeTree) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._typeExpression = typeExpression; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): AnnotatedType { + return id === this._id ? this : new AnnotatedType(id, this._prefix, this._markers, this._annotations, this._typeExpression); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): AnnotatedType { + return prefix === this._prefix ? this : new AnnotatedType(this._id, prefix, this._markers, this._annotations, this._typeExpression); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): AnnotatedType { + return markers === this._markers ? this : new AnnotatedType(this._id, this._prefix, markers, this._annotations, this._typeExpression); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): AnnotatedType { + return annotations === this._annotations ? this : new AnnotatedType(this._id, this._prefix, this._markers, annotations, this._typeExpression); + } + + private readonly _typeExpression: TypeTree; + + public get typeExpression(): TypeTree { + return this._typeExpression; + } + + public withTypeExpression(typeExpression: TypeTree): AnnotatedType { + return typeExpression === this._typeExpression ? this : new AnnotatedType(this._id, this._prefix, this._markers, this._annotations, typeExpression); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitAnnotatedType(this, p); + } + +} + +export class Annotation extends J implements Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, annotationType: NameTree, _arguments: JContainer | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotationType = annotationType; + this.__arguments = _arguments; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Annotation { + return id === this._id ? this : new Annotation(id, this._prefix, this._markers, this._annotationType, this.__arguments); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Annotation { + return prefix === this._prefix ? this : new Annotation(this._id, prefix, this._markers, this._annotationType, this.__arguments); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Annotation { + return markers === this._markers ? this : new Annotation(this._id, this._prefix, markers, this._annotationType, this.__arguments); + } + + private readonly _annotationType: NameTree; + + public get annotationType(): NameTree { + return this._annotationType; + } + + public withAnnotationType(annotationType: NameTree): Annotation { + return annotationType === this._annotationType ? this : new Annotation(this._id, this._prefix, this._markers, annotationType, this.__arguments); + } + + private readonly __arguments: JContainer | null; + + public get _arguments(): Expression[] | null { + return this.__arguments === null ? null : this.__arguments.elements; + } + + public withArguments(_arguments: Expression[] | null): Annotation { + return this.padding.withArguments(JContainer.withElementsNullable(this.__arguments, _arguments)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitAnnotation(this, p); + } + + get padding() { + const t = this; + return new class { + public get _arguments(): JContainer | null { + return t.__arguments; + } + public withArguments(_arguments: JContainer | null): Annotation { + return t._arguments === _arguments ? t : new Annotation(t._id, t._prefix, t._markers, t._annotationType, _arguments); + } + } + } + +} + +export class ArrayAccess extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, indexed: Expression, dimension: ArrayDimension, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._indexed = indexed; + this._dimension = dimension; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ArrayAccess { + return id === this._id ? this : new ArrayAccess(id, this._prefix, this._markers, this._indexed, this._dimension, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ArrayAccess { + return prefix === this._prefix ? this : new ArrayAccess(this._id, prefix, this._markers, this._indexed, this._dimension, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ArrayAccess { + return markers === this._markers ? this : new ArrayAccess(this._id, this._prefix, markers, this._indexed, this._dimension, this.__type); + } + + private readonly _indexed: Expression; + + public get indexed(): Expression { + return this._indexed; + } + + public withIndexed(indexed: Expression): ArrayAccess { + return indexed === this._indexed ? this : new ArrayAccess(this._id, this._prefix, this._markers, indexed, this._dimension, this.__type); + } + + private readonly _dimension: ArrayDimension; + + public get dimension(): ArrayDimension { + return this._dimension; + } + + public withDimension(dimension: ArrayDimension): ArrayAccess { + return dimension === this._dimension ? this : new ArrayAccess(this._id, this._prefix, this._markers, this._indexed, dimension, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): ArrayAccess { + return _type === this.__type ? this : new ArrayAccess(this._id, this._prefix, this._markers, this._indexed, this._dimension, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitArrayAccess(this, p); + } + +} + +export class ArrayType extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, elementType: TypeTree, annotations: Annotation[] | null, dimension: JLeftPadded | null, _type: JavaType) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._elementType = elementType; + this._annotations = annotations; + this._dimension = dimension; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ArrayType { + return id === this._id ? this : new ArrayType(id, this._prefix, this._markers, this._elementType, this._annotations, this._dimension, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ArrayType { + return prefix === this._prefix ? this : new ArrayType(this._id, prefix, this._markers, this._elementType, this._annotations, this._dimension, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ArrayType { + return markers === this._markers ? this : new ArrayType(this._id, this._prefix, markers, this._elementType, this._annotations, this._dimension, this.__type); + } + + private readonly _elementType: TypeTree; + + public get elementType(): TypeTree { + return this._elementType; + } + + public withElementType(elementType: TypeTree): ArrayType { + return elementType === this._elementType ? this : new ArrayType(this._id, this._prefix, this._markers, elementType, this._annotations, this._dimension, this.__type); + } + + private readonly _annotations: Annotation[] | null; + + public get annotations(): Annotation[] | null { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[] | null): ArrayType { + return annotations === this._annotations ? this : new ArrayType(this._id, this._prefix, this._markers, this._elementType, annotations, this._dimension, this.__type); + } + + private readonly _dimension: JLeftPadded | null; + + public get dimension(): JLeftPadded | null { + return this._dimension; + } + + public withDimension(dimension: JLeftPadded | null): ArrayType { + return dimension === this._dimension ? this : new ArrayType(this._id, this._prefix, this._markers, this._elementType, this._annotations, dimension, this.__type); + } + + private readonly __type: JavaType; + + public get _type(): JavaType { + return this.__type; + } + + public withType(_type: JavaType): ArrayType { + return _type === this.__type ? this : new ArrayType(this._id, this._prefix, this._markers, this._elementType, this._annotations, this._dimension, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitArrayType(this, p); + } + +} + +export class Assert extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, condition: Expression, detail: JLeftPadded | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._condition = condition; + this._detail = detail; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Assert { + return id === this._id ? this : new Assert(id, this._prefix, this._markers, this._condition, this._detail); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Assert { + return prefix === this._prefix ? this : new Assert(this._id, prefix, this._markers, this._condition, this._detail); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Assert { + return markers === this._markers ? this : new Assert(this._id, this._prefix, markers, this._condition, this._detail); + } + + private readonly _condition: Expression; + + public get condition(): Expression { + return this._condition; + } + + public withCondition(condition: Expression): Assert { + return condition === this._condition ? this : new Assert(this._id, this._prefix, this._markers, condition, this._detail); + } + + private readonly _detail: JLeftPadded | null; + + public get detail(): JLeftPadded | null { + return this._detail; + } + + public withDetail(detail: JLeftPadded | null): Assert { + return detail === this._detail ? this : new Assert(this._id, this._prefix, this._markers, this._condition, detail); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitAssert(this, p); + } + +} + +export class Assignment extends J implements Statement, Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, variable: Expression, assignment: JLeftPadded, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._variable = variable; + this._assignment = assignment; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Assignment { + return id === this._id ? this : new Assignment(id, this._prefix, this._markers, this._variable, this._assignment, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Assignment { + return prefix === this._prefix ? this : new Assignment(this._id, prefix, this._markers, this._variable, this._assignment, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Assignment { + return markers === this._markers ? this : new Assignment(this._id, this._prefix, markers, this._variable, this._assignment, this.__type); + } + + private readonly _variable: Expression; + + public get variable(): Expression { + return this._variable; + } + + public withVariable(variable: Expression): Assignment { + return variable === this._variable ? this : new Assignment(this._id, this._prefix, this._markers, variable, this._assignment, this.__type); + } + + private readonly _assignment: JLeftPadded; + + public get assignment(): Expression { + return this._assignment.element; + } + + public withAssignment(assignment: Expression): Assignment { + return this.padding.withAssignment(JLeftPadded.withElement(this._assignment, assignment)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Assignment { + return _type === this.__type ? this : new Assignment(this._id, this._prefix, this._markers, this._variable, this._assignment, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitAssignment(this, p); + } + + get padding() { + const t = this; + return new class { + public get assignment(): JLeftPadded { + return t._assignment; + } + public withAssignment(assignment: JLeftPadded): Assignment { + return t._assignment === assignment ? t : new Assignment(t._id, t._prefix, t._markers, t._variable, assignment, t.__type); + } + } + } + +} + +export class AssignmentOperation extends J implements Statement, Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, variable: Expression, operator: JLeftPadded, assignment: Expression, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._variable = variable; + this._operator = operator; + this._assignment = assignment; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): AssignmentOperation { + return id === this._id ? this : new AssignmentOperation(id, this._prefix, this._markers, this._variable, this._operator, this._assignment, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): AssignmentOperation { + return prefix === this._prefix ? this : new AssignmentOperation(this._id, prefix, this._markers, this._variable, this._operator, this._assignment, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): AssignmentOperation { + return markers === this._markers ? this : new AssignmentOperation(this._id, this._prefix, markers, this._variable, this._operator, this._assignment, this.__type); + } + + private readonly _variable: Expression; + + public get variable(): Expression { + return this._variable; + } + + public withVariable(variable: Expression): AssignmentOperation { + return variable === this._variable ? this : new AssignmentOperation(this._id, this._prefix, this._markers, variable, this._operator, this._assignment, this.__type); + } + + private readonly _operator: JLeftPadded; + + public get operator(): AssignmentOperationType { + return this._operator.element; + } + + public withOperator(operator: AssignmentOperationType): AssignmentOperation { + return this.padding.withOperator(JLeftPadded.withElement(this._operator, operator)); + } + + private readonly _assignment: Expression; + + public get assignment(): Expression { + return this._assignment; + } + + public withAssignment(assignment: Expression): AssignmentOperation { + return assignment === this._assignment ? this : new AssignmentOperation(this._id, this._prefix, this._markers, this._variable, this._operator, assignment, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): AssignmentOperation { + return _type === this.__type ? this : new AssignmentOperation(this._id, this._prefix, this._markers, this._variable, this._operator, this._assignment, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitAssignmentOperation(this, p); + } + + get padding() { + const t = this; + return new class { + public get operator(): JLeftPadded { + return t._operator; + } + public withOperator(operator: JLeftPadded): AssignmentOperation { + return t._operator === operator ? t : new AssignmentOperation(t._id, t._prefix, t._markers, t._variable, operator, t._assignment, t.__type); + } + } + } + +} + +enum AssignmentOperationType { + Addition = 0, + BitAnd = 1, + BitOr = 2, + BitXor = 3, + Division = 4, + Exponentiation = 5, + FloorDivision = 6, + LeftShift = 7, + MatrixMultiplication = 8, + Modulo = 9, + Multiplication = 10, + RightShift = 11, + Subtraction = 12, + UnsignedRightShift = 13, + +} + +export class Binary extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, left: Expression, operator: JLeftPadded, right: Expression, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._left = left; + this._operator = operator; + this._right = right; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Binary { + return id === this._id ? this : new Binary(id, this._prefix, this._markers, this._left, this._operator, this._right, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Binary { + return prefix === this._prefix ? this : new Binary(this._id, prefix, this._markers, this._left, this._operator, this._right, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Binary { + return markers === this._markers ? this : new Binary(this._id, this._prefix, markers, this._left, this._operator, this._right, this.__type); + } + + private readonly _left: Expression; + + public get left(): Expression { + return this._left; + } + + public withLeft(left: Expression): Binary { + return left === this._left ? this : new Binary(this._id, this._prefix, this._markers, left, this._operator, this._right, this.__type); + } + + private readonly _operator: JLeftPadded; + + public get operator(): BinaryType { + return this._operator.element; + } + + public withOperator(operator: BinaryType): Binary { + return this.padding.withOperator(JLeftPadded.withElement(this._operator, operator)); + } + + private readonly _right: Expression; + + public get right(): Expression { + return this._right; + } + + public withRight(right: Expression): Binary { + return right === this._right ? this : new Binary(this._id, this._prefix, this._markers, this._left, this._operator, right, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Binary { + return _type === this.__type ? this : new Binary(this._id, this._prefix, this._markers, this._left, this._operator, this._right, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitBinary(this, p); + } + + get padding() { + const t = this; + return new class { + public get operator(): JLeftPadded { + return t._operator; + } + public withOperator(operator: JLeftPadded): Binary { + return t._operator === operator ? t : new Binary(t._id, t._prefix, t._markers, t._left, operator, t._right, t.__type); + } + } + } + +} + +enum BinaryType { + Addition = 0, + Subtraction = 1, + Multiplication = 2, + Division = 3, + Modulo = 4, + LessThan = 5, + GreaterThan = 6, + LessThanOrEqual = 7, + GreaterThanOrEqual = 8, + Equal = 9, + NotEqual = 10, + BitAnd = 11, + BitOr = 12, + BitXor = 13, + LeftShift = 14, + RightShift = 15, + UnsignedRightShift = 16, + Or = 17, + And = 18, + +} + +export class Block extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, _static: JRightPadded, statements: JRightPadded[], end: Space) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this.__static = _static; + this._statements = statements; + this._end = end; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Block { + return id === this._id ? this : new Block(id, this._prefix, this._markers, this.__static, this._statements, this._end); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Block { + return prefix === this._prefix ? this : new Block(this._id, prefix, this._markers, this.__static, this._statements, this._end); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Block { + return markers === this._markers ? this : new Block(this._id, this._prefix, markers, this.__static, this._statements, this._end); + } + + private readonly __static: JRightPadded; + + public get _static(): boolean { + return this.__static.element; + } + + public withStatic(_static: boolean): Block { + return this.padding.withStatic(JRightPadded.withElement(this.__static, _static)); + } + + private readonly _statements: JRightPadded[]; + + public get statements(): Statement[] { + return JRightPadded.getElements(this._statements); + } + + public withStatements(statements: Statement[]): Block { + return this.padding.withStatements(JRightPadded.withElements(this._statements, statements)); + } + + private readonly _end: Space; + + public get end(): Space { + return this._end; + } + + public withEnd(end: Space): Block { + return end === this._end ? this : new Block(this._id, this._prefix, this._markers, this.__static, this._statements, end); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitBlock(this, p); + } + + get padding() { + const t = this; + return new class { + public get _static(): JRightPadded { + return t.__static; + } + public withStatic(_static: JRightPadded): Block { + return t._static === _static ? t : new Block(t._id, t._prefix, t._markers, _static, t._statements, t._end); + } + public get statements(): JRightPadded[] { + return t._statements; + } + public withStatements(statements: JRightPadded[]): Block { + return t._statements === statements ? t : new Block(t._id, t._prefix, t._markers, t.__static, statements, t._end); + } + } + } + +} + +export class Break extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, label: Identifier | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._label = label; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Break { + return id === this._id ? this : new Break(id, this._prefix, this._markers, this._label); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Break { + return prefix === this._prefix ? this : new Break(this._id, prefix, this._markers, this._label); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Break { + return markers === this._markers ? this : new Break(this._id, this._prefix, markers, this._label); + } + + private readonly _label: Identifier | null; + + public get label(): Identifier | null { + return this._label; + } + + public withLabel(label: Identifier | null): Break { + return label === this._label ? this : new Break(this._id, this._prefix, this._markers, label); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitBreak(this, p); + } + +} + +export class Case extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, _type: CaseType, expressions: JContainer, statements: JContainer, body: JRightPadded | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this.__type = _type; + this._expressions = expressions; + this._statements = statements; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Case { + return id === this._id ? this : new Case(id, this._prefix, this._markers, this.__type, this._expressions, this._statements, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Case { + return prefix === this._prefix ? this : new Case(this._id, prefix, this._markers, this.__type, this._expressions, this._statements, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Case { + return markers === this._markers ? this : new Case(this._id, this._prefix, markers, this.__type, this._expressions, this._statements, this._body); + } + + private readonly __type: CaseType; + + public withType(_type: CaseType): Case { + return _type === this.__type ? this : new Case(this._id, this._prefix, this._markers, _type, this._expressions, this._statements, this._body); + } + + private readonly _expressions: JContainer; + + public get expressions(): Expression[] { + return this._expressions.elements; + } + + public withExpressions(expressions: Expression[]): Case { + return this.padding.withExpressions(JContainer.withElements(this._expressions, expressions)); + } + + private readonly _statements: JContainer; + + public get statements(): Statement[] { + return this._statements.elements; + } + + public withStatements(statements: Statement[]): Case { + return this.padding.withStatements(JContainer.withElements(this._statements, statements)); + } + + private readonly _body: JRightPadded | null; + + public get body(): J | null { + return this._body === null ? null : this._body.element; + } + + public withBody(body: J | null): Case { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitCase(this, p); + } + + get padding() { + const t = this; + return new class { + public get expressions(): JContainer { + return t._expressions; + } + public withExpressions(expressions: JContainer): Case { + return t._expressions === expressions ? t : new Case(t._id, t._prefix, t._markers, t.__type, expressions, t._statements, t._body); + } + public get statements(): JContainer { + return t._statements; + } + public withStatements(statements: JContainer): Case { + return t._statements === statements ? t : new Case(t._id, t._prefix, t._markers, t.__type, t._expressions, statements, t._body); + } + public get body(): JRightPadded | null { + return t._body; + } + public withBody(body: JRightPadded | null): Case { + return t._body === body ? t : new Case(t._id, t._prefix, t._markers, t.__type, t._expressions, t._statements, body); + } + } + } + +} + +enum CaseType { + Statement = 0, + Rule = 1, + +} + +export class ClassDeclaration extends J implements Statement, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, leadingAnnotations: Annotation[], modifiers: Modifier[], kind: ClassDeclarationKind, name: Identifier, typeParameters: JContainer | null, primaryConstructor: JContainer | null, extends: JLeftPadded | null, implements: JContainer | null, permits: JContainer | null, body: Block, _type: JavaType.FullyQualified | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._leadingAnnotations = leadingAnnotations; + this._modifiers = modifiers; + this._kind = kind; + this._name = name; + this._typeParameters = typeParameters; + this._primaryConstructor = primaryConstructor; + this._extends = extends; + this._implements = implements; + this._permits = permits; + this._body = body; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ClassDeclaration { + return id === this._id ? this : new ClassDeclaration(id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ClassDeclaration { + return prefix === this._prefix ? this : new ClassDeclaration(this._id, prefix, this._markers, this._leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ClassDeclaration { + return markers === this._markers ? this : new ClassDeclaration(this._id, this._prefix, markers, this._leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _leadingAnnotations: Annotation[]; + + public get leadingAnnotations(): Annotation[] { + return this._leadingAnnotations; + } + + public withLeadingAnnotations(leadingAnnotations: Annotation[]): ClassDeclaration { + return leadingAnnotations === this._leadingAnnotations ? this : new ClassDeclaration(this._id, this._prefix, this._markers, leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _modifiers: Modifier[]; + + public get modifiers(): Modifier[] { + return this._modifiers; + } + + public withModifiers(modifiers: Modifier[]): ClassDeclaration { + return modifiers === this._modifiers ? this : new ClassDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _kind: ClassDeclarationKind; + + public withKind(kind: ClassDeclarationKind): ClassDeclaration { + return kind === this._kind ? this : new ClassDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _name: Identifier; + + public get name(): Identifier { + return this._name; + } + + public withName(name: Identifier): ClassDeclaration { + return name === this._name ? this : new ClassDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._kind, name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, this.__type); + } + + private readonly _typeParameters: JContainer | null; + + public get typeParameters(): TypeParameter[] | null { + return this._typeParameters === null ? null : this._typeParameters.elements; + } + + public withTypeParameters(typeParameters: TypeParameter[] | null): ClassDeclaration { + return this.padding.withTypeParameters(JContainer.withElementsNullable(this._typeParameters, typeParameters)); + } + + private readonly _primaryConstructor: JContainer | null; + + public get primaryConstructor(): Statement[] | null { + return this._primaryConstructor === null ? null : this._primaryConstructor.elements; + } + + public withPrimaryConstructor(primaryConstructor: Statement[] | null): ClassDeclaration { + return this.padding.withPrimaryConstructor(JContainer.withElementsNullable(this._primaryConstructor, primaryConstructor)); + } + + private readonly _extends: JLeftPadded | null; + + public get _extends(): TypeTree | null { + return this._extends === null ? null : this._extends.element; + } + + public withExtends(_extends: TypeTree | null): ClassDeclaration { + return this.padding.withExtends(JLeftPadded.withElement(this._extends, _extends)); + } + + private readonly _implements: JContainer | null; + + public get _implements(): TypeTree[] | null { + return this._implements === null ? null : this._implements.elements; + } + + public withImplements(_implements: TypeTree[] | null): ClassDeclaration { + return this.padding.withImplements(JContainer.withElementsNullable(this._implements, _implements)); + } + + private readonly _permits: JContainer | null; + + public get permits(): TypeTree[] | null { + return this._permits === null ? null : this._permits.elements; + } + + public withPermits(permits: TypeTree[] | null): ClassDeclaration { + return this.padding.withPermits(JContainer.withElementsNullable(this._permits, permits)); + } + + private readonly _body: Block; + + public get body(): Block { + return this._body; + } + + public withBody(body: Block): ClassDeclaration { + return body === this._body ? this : new ClassDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, body, this.__type); + } + + private readonly __type: JavaType.FullyQualified | null; + + public get _type(): JavaType.FullyQualified | null { + return this.__type; + } + + public withType(_type: JavaType.FullyQualified | null): ClassDeclaration { + return _type === this.__type ? this : new ClassDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._kind, this._name, this._typeParameters, this._primaryConstructor, this._extends, this._implements, this._permits, this._body, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitClassDeclaration(this, p); + } + + get padding() { + const t = this; + return new class { + public get kind(): ClassDeclarationKind { + return t._kind; + } + public withKind(kind: ClassDeclarationKind): ClassDeclaration { + return t._kind === kind ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, kind, t._name, t._typeParameters, t._primaryConstructor, t._extends, t._implements, t._permits, t._body, t.__type); + } + public get typeParameters(): JContainer | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: JContainer | null): ClassDeclaration { + return t._typeParameters === typeParameters ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._kind, t._name, typeParameters, t._primaryConstructor, t._extends, t._implements, t._permits, t._body, t.__type); + } + public get primaryConstructor(): JContainer | null { + return t._primaryConstructor; + } + public withPrimaryConstructor(primaryConstructor: JContainer | null): ClassDeclaration { + return t._primaryConstructor === primaryConstructor ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._kind, t._name, t._typeParameters, primaryConstructor, t._extends, t._implements, t._permits, t._body, t.__type); + } + public get _extends(): JLeftPadded | null { + return t._extends; + } + public withExtends(_extends: JLeftPadded | null): ClassDeclaration { + return t._extends === _extends ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._kind, t._name, t._typeParameters, t._primaryConstructor, _extends, t._implements, t._permits, t._body, t.__type); + } + public get _implements(): JContainer | null { + return t._implements; + } + public withImplements(_implements: JContainer | null): ClassDeclaration { + return t._implements === _implements ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._kind, t._name, t._typeParameters, t._primaryConstructor, t._extends, _implements, t._permits, t._body, t.__type); + } + public get permits(): JContainer | null { + return t._permits; + } + public withPermits(permits: JContainer | null): ClassDeclaration { + return t._permits === permits ? t : new ClassDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._kind, t._name, t._typeParameters, t._primaryConstructor, t._extends, t._implements, permits, t._body, t.__type); + } + } + } + +} + +export class ClassDeclarationKind extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], _type: ClassDeclarationKindType) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ClassDeclarationKind { + return id === this._id ? this : new ClassDeclarationKind(id, this._prefix, this._markers, this._annotations, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ClassDeclarationKind { + return prefix === this._prefix ? this : new ClassDeclarationKind(this._id, prefix, this._markers, this._annotations, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ClassDeclarationKind { + return markers === this._markers ? this : new ClassDeclarationKind(this._id, this._prefix, markers, this._annotations, this.__type); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): ClassDeclarationKind { + return annotations === this._annotations ? this : new ClassDeclarationKind(this._id, this._prefix, this._markers, annotations, this.__type); + } + + private readonly __type: ClassDeclarationKindType; + + public get _type(): ClassDeclarationKindType { + return this.__type; + } + + public withType(_type: ClassDeclarationKindType): ClassDeclarationKind { + return _type === this.__type ? this : new ClassDeclarationKind(this._id, this._prefix, this._markers, this._annotations, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitClassDeclarationKind(this, p); + } + +} + +enum ClassDeclarationKindType { + Class = 0, + Enum = 1, + Interface = 2, + Annotation = 3, + Record = 4, + Value = 5, + +} + +export class CompilationUnit extends J implements JavaSourceFile, SourceFile { + public constructor(id: UUID, prefix: Space, markers: Markers, sourcePath: string, fileAttributes: FileAttributes | null, charsetName: string | null, charsetBomMarked: boolean, checksum: Checksum | null, packageDeclaration: JRightPadded | null, imports: JRightPadded[], classes: ClassDeclaration[], eof: Space) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._sourcePath = sourcePath; + this._fileAttributes = fileAttributes; + this._charsetName = charsetName; + this._charsetBomMarked = charsetBomMarked; + this._checksum = checksum; + this._packageDeclaration = packageDeclaration; + this._imports = imports; + this._classes = classes; + this._eof = eof; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): CompilationUnit { + return id === this._id ? this : new CompilationUnit(id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): CompilationUnit { + return prefix === this._prefix ? this : new CompilationUnit(this._id, prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): CompilationUnit { + return markers === this._markers ? this : new CompilationUnit(this._id, this._prefix, markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _sourcePath: string; + + public get sourcePath(): string { + return this._sourcePath; + } + + public withSourcePath(sourcePath: string): CompilationUnit { + return sourcePath === this._sourcePath ? this : new CompilationUnit(this._id, this._prefix, this._markers, sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _fileAttributes: FileAttributes | null; + + public get fileAttributes(): FileAttributes | null { + return this._fileAttributes; + } + + public withFileAttributes(fileAttributes: FileAttributes | null): CompilationUnit { + return fileAttributes === this._fileAttributes ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _charsetName: string | null; + + public withCharsetName(charsetName: string | null): CompilationUnit { + return charsetName === this._charsetName ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _charsetBomMarked: boolean; + + public get charsetBomMarked(): boolean { + return this._charsetBomMarked; + } + + public withCharsetBomMarked(charsetBomMarked: boolean): CompilationUnit { + return charsetBomMarked === this._charsetBomMarked ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _checksum: Checksum | null; + + public get checksum(): Checksum | null { + return this._checksum; + } + + public withChecksum(checksum: Checksum | null): CompilationUnit { + return checksum === this._checksum ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, checksum, this._packageDeclaration, this._imports, this._classes, this._eof); + } + + private readonly _packageDeclaration: JRightPadded | null; + + public get packageDeclaration(): Package | null { + return this._packageDeclaration === null ? null : this._packageDeclaration.element; + } + + public withPackageDeclaration(packageDeclaration: Package | null): CompilationUnit { + return this.padding.withPackageDeclaration(JRightPadded.withElement(this._packageDeclaration, packageDeclaration)); + } + + private readonly _imports: JRightPadded[]; + + public get imports(): Import[] { + return JRightPadded.getElements(this._imports); + } + + public withImports(imports: Import[]): CompilationUnit { + return this.padding.withImports(JRightPadded.withElements(this._imports, imports)); + } + + private readonly _classes: ClassDeclaration[]; + + public get classes(): ClassDeclaration[] { + return this._classes; + } + + public withClasses(classes: ClassDeclaration[]): CompilationUnit { + return classes === this._classes ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, classes, this._eof); + } + + private readonly _eof: Space; + + public get eof(): Space { + return this._eof; + } + + public withEof(eof: Space): CompilationUnit { + return eof === this._eof ? this : new CompilationUnit(this._id, this._prefix, this._markers, this._sourcePath, this._fileAttributes, this._charsetName, this._charsetBomMarked, this._checksum, this._packageDeclaration, this._imports, this._classes, eof); + } + + public printer

(cursor: Cursor): TreeVisitor> { + return PrinterFactory.current().createPrinter(cursor); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitCompilationUnit(this, p); + } + + get padding() { + const t = this; + return new class { + public get packageDeclaration(): JRightPadded | null { + return t._packageDeclaration; + } + public withPackageDeclaration(packageDeclaration: JRightPadded | null): CompilationUnit { + return t._packageDeclaration === packageDeclaration ? t : new CompilationUnit(t._id, t._prefix, t._markers, t._sourcePath, t._fileAttributes, t._charsetName, t._charsetBomMarked, t._checksum, packageDeclaration, t._imports, t._classes, t._eof); + } + public get imports(): JRightPadded[] { + return t._imports; + } + public withImports(imports: JRightPadded[]): CompilationUnit { + return t._imports === imports ? t : new CompilationUnit(t._id, t._prefix, t._markers, t._sourcePath, t._fileAttributes, t._charsetName, t._charsetBomMarked, t._checksum, t._packageDeclaration, imports, t._classes, t._eof); + } + } + } + +} + +export class Continue extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, label: Identifier | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._label = label; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Continue { + return id === this._id ? this : new Continue(id, this._prefix, this._markers, this._label); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Continue { + return prefix === this._prefix ? this : new Continue(this._id, prefix, this._markers, this._label); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Continue { + return markers === this._markers ? this : new Continue(this._id, this._prefix, markers, this._label); + } + + private readonly _label: Identifier | null; + + public get label(): Identifier | null { + return this._label; + } + + public withLabel(label: Identifier | null): Continue { + return label === this._label ? this : new Continue(this._id, this._prefix, this._markers, label); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitContinue(this, p); + } + +} + +export class DoWhileLoop extends J implements Loop { + public constructor(id: UUID, prefix: Space, markers: Markers, body: JRightPadded, whileCondition: JLeftPadded>) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._body = body; + this._whileCondition = whileCondition; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): DoWhileLoop { + return id === this._id ? this : new DoWhileLoop(id, this._prefix, this._markers, this._body, this._whileCondition); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): DoWhileLoop { + return prefix === this._prefix ? this : new DoWhileLoop(this._id, prefix, this._markers, this._body, this._whileCondition); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): DoWhileLoop { + return markers === this._markers ? this : new DoWhileLoop(this._id, this._prefix, markers, this._body, this._whileCondition); + } + + private readonly _body: JRightPadded; + + public get body(): Statement { + return this._body.element; + } + + public withBody(body: Statement): DoWhileLoop { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + private readonly _whileCondition: JLeftPadded>; + + public get whileCondition(): ControlParentheses { + return this._whileCondition.element; + } + + public withWhileCondition(whileCondition: ControlParentheses): DoWhileLoop { + return this.padding.withWhileCondition(JLeftPadded.withElement(this._whileCondition, whileCondition)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitDoWhileLoop(this, p); + } + + get padding() { + const t = this; + return new class { + public get body(): JRightPadded { + return t._body; + } + public withBody(body: JRightPadded): DoWhileLoop { + return t._body === body ? t : new DoWhileLoop(t._id, t._prefix, t._markers, body, t._whileCondition); + } + public get whileCondition(): JLeftPadded> { + return t._whileCondition; + } + public withWhileCondition(whileCondition: JLeftPadded>): DoWhileLoop { + return t._whileCondition === whileCondition ? t : new DoWhileLoop(t._id, t._prefix, t._markers, t._body, whileCondition); + } + } + } + +} + +export class Empty extends J implements Statement, Expression, TypeTree { + public constructor(id: UUID, prefix: Space, markers: Markers) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Empty { + return id === this._id ? this : new Empty(id, this._prefix, this._markers); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Empty { + return prefix === this._prefix ? this : new Empty(this._id, prefix, this._markers); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Empty { + return markers === this._markers ? this : new Empty(this._id, this._prefix, markers); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitEmpty(this, p); + } + +} + +export class EnumValue extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], name: Identifier, initializer: NewClass | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._name = name; + this._initializer = initializer; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): EnumValue { + return id === this._id ? this : new EnumValue(id, this._prefix, this._markers, this._annotations, this._name, this._initializer); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): EnumValue { + return prefix === this._prefix ? this : new EnumValue(this._id, prefix, this._markers, this._annotations, this._name, this._initializer); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): EnumValue { + return markers === this._markers ? this : new EnumValue(this._id, this._prefix, markers, this._annotations, this._name, this._initializer); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): EnumValue { + return annotations === this._annotations ? this : new EnumValue(this._id, this._prefix, this._markers, annotations, this._name, this._initializer); + } + + private readonly _name: Identifier; + + public get name(): Identifier { + return this._name; + } + + public withName(name: Identifier): EnumValue { + return name === this._name ? this : new EnumValue(this._id, this._prefix, this._markers, this._annotations, name, this._initializer); + } + + private readonly _initializer: NewClass | null; + + public get initializer(): NewClass | null { + return this._initializer; + } + + public withInitializer(initializer: NewClass | null): EnumValue { + return initializer === this._initializer ? this : new EnumValue(this._id, this._prefix, this._markers, this._annotations, this._name, initializer); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitEnumValue(this, p); + } + +} + +export class EnumValueSet extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, enums: JRightPadded[], terminatedWithSemicolon: boolean) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._enums = enums; + this._terminatedWithSemicolon = terminatedWithSemicolon; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): EnumValueSet { + return id === this._id ? this : new EnumValueSet(id, this._prefix, this._markers, this._enums, this._terminatedWithSemicolon); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): EnumValueSet { + return prefix === this._prefix ? this : new EnumValueSet(this._id, prefix, this._markers, this._enums, this._terminatedWithSemicolon); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): EnumValueSet { + return markers === this._markers ? this : new EnumValueSet(this._id, this._prefix, markers, this._enums, this._terminatedWithSemicolon); + } + + private readonly _enums: JRightPadded[]; + + public get enums(): EnumValue[] { + return JRightPadded.getElements(this._enums); + } + + public withEnums(enums: EnumValue[]): EnumValueSet { + return this.padding.withEnums(JRightPadded.withElements(this._enums, enums)); + } + + private readonly _terminatedWithSemicolon: boolean; + + public get terminatedWithSemicolon(): boolean { + return this._terminatedWithSemicolon; + } + + public withTerminatedWithSemicolon(terminatedWithSemicolon: boolean): EnumValueSet { + return terminatedWithSemicolon === this._terminatedWithSemicolon ? this : new EnumValueSet(this._id, this._prefix, this._markers, this._enums, terminatedWithSemicolon); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitEnumValueSet(this, p); + } + + get padding() { + const t = this; + return new class { + public get enums(): JRightPadded[] { + return t._enums; + } + public withEnums(enums: JRightPadded[]): EnumValueSet { + return t._enums === enums ? t : new EnumValueSet(t._id, t._prefix, t._markers, enums, t._terminatedWithSemicolon); + } + } + } + +} + +export class FieldAccess extends J implements TypeTree, Expression, Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, target: Expression, name: JLeftPadded, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._target = target; + this._name = name; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): FieldAccess { + return id === this._id ? this : new FieldAccess(id, this._prefix, this._markers, this._target, this._name, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): FieldAccess { + return prefix === this._prefix ? this : new FieldAccess(this._id, prefix, this._markers, this._target, this._name, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): FieldAccess { + return markers === this._markers ? this : new FieldAccess(this._id, this._prefix, markers, this._target, this._name, this.__type); + } + + private readonly _target: Expression; + + public get target(): Expression { + return this._target; + } + + public withTarget(target: Expression): FieldAccess { + return target === this._target ? this : new FieldAccess(this._id, this._prefix, this._markers, target, this._name, this.__type); + } + + private readonly _name: JLeftPadded; + + public get name(): Identifier { + return this._name.element; + } + + public withName(name: Identifier): FieldAccess { + return this.padding.withName(JLeftPadded.withElement(this._name, name)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): FieldAccess { + return _type === this.__type ? this : new FieldAccess(this._id, this._prefix, this._markers, this._target, this._name, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitFieldAccess(this, p); + } + + get padding() { + const t = this; + return new class { + public get name(): JLeftPadded { + return t._name; + } + public withName(name: JLeftPadded): FieldAccess { + return t._name === name ? t : new FieldAccess(t._id, t._prefix, t._markers, t._target, name, t.__type); + } + } + } + +} + +export class ForEachLoop extends J implements Loop { + public constructor(id: UUID, prefix: Space, markers: Markers, control: ForEachLoopControl, body: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._control = control; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ForEachLoop { + return id === this._id ? this : new ForEachLoop(id, this._prefix, this._markers, this._control, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ForEachLoop { + return prefix === this._prefix ? this : new ForEachLoop(this._id, prefix, this._markers, this._control, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ForEachLoop { + return markers === this._markers ? this : new ForEachLoop(this._id, this._prefix, markers, this._control, this._body); + } + + private readonly _control: ForEachLoopControl; + + public get control(): ForEachLoopControl { + return this._control; + } + + public withControl(control: ForEachLoopControl): ForEachLoop { + return control === this._control ? this : new ForEachLoop(this._id, this._prefix, this._markers, control, this._body); + } + + private readonly _body: JRightPadded; + + public get body(): Statement { + return this._body.element; + } + + public withBody(body: Statement): ForEachLoop { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitForEachLoop(this, p); + } + + get padding() { + const t = this; + return new class { + public get body(): JRightPadded { + return t._body; + } + public withBody(body: JRightPadded): ForEachLoop { + return t._body === body ? t : new ForEachLoop(t._id, t._prefix, t._markers, t._control, body); + } + } + } + +} + +export class ForEachLoopControl extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, variable: JRightPadded, iterable: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._variable = variable; + this._iterable = iterable; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ForEachLoopControl { + return id === this._id ? this : new ForEachLoopControl(id, this._prefix, this._markers, this._variable, this._iterable); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ForEachLoopControl { + return prefix === this._prefix ? this : new ForEachLoopControl(this._id, prefix, this._markers, this._variable, this._iterable); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ForEachLoopControl { + return markers === this._markers ? this : new ForEachLoopControl(this._id, this._prefix, markers, this._variable, this._iterable); + } + + private readonly _variable: JRightPadded; + + public get variable(): VariableDeclarations { + return this._variable.element; + } + + public withVariable(variable: VariableDeclarations): ForEachLoopControl { + return this.padding.withVariable(JRightPadded.withElement(this._variable, variable)); + } + + private readonly _iterable: JRightPadded; + + public get iterable(): Expression { + return this._iterable.element; + } + + public withIterable(iterable: Expression): ForEachLoopControl { + return this.padding.withIterable(JRightPadded.withElement(this._iterable, iterable)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitForEachControl(this, p); + } + + get padding() { + const t = this; + return new class { + public get variable(): JRightPadded { + return t._variable; + } + public withVariable(variable: JRightPadded): ForEachLoopControl { + return t._variable === variable ? t : new ForEachLoopControl(t._id, t._prefix, t._markers, variable, t._iterable); + } + public get iterable(): JRightPadded { + return t._iterable; + } + public withIterable(iterable: JRightPadded): ForEachLoopControl { + return t._iterable === iterable ? t : new ForEachLoopControl(t._id, t._prefix, t._markers, t._variable, iterable); + } + } + } + +} + +export class ForLoop extends J implements Loop { + public constructor(id: UUID, prefix: Space, markers: Markers, control: ForLoopControl, body: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._control = control; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ForLoop { + return id === this._id ? this : new ForLoop(id, this._prefix, this._markers, this._control, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ForLoop { + return prefix === this._prefix ? this : new ForLoop(this._id, prefix, this._markers, this._control, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ForLoop { + return markers === this._markers ? this : new ForLoop(this._id, this._prefix, markers, this._control, this._body); + } + + private readonly _control: ForLoopControl; + + public get control(): ForLoopControl { + return this._control; + } + + public withControl(control: ForLoopControl): ForLoop { + return control === this._control ? this : new ForLoop(this._id, this._prefix, this._markers, control, this._body); + } + + private readonly _body: JRightPadded; + + public get body(): Statement { + return this._body.element; + } + + public withBody(body: Statement): ForLoop { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitForLoop(this, p); + } + + get padding() { + const t = this; + return new class { + public get body(): JRightPadded { + return t._body; + } + public withBody(body: JRightPadded): ForLoop { + return t._body === body ? t : new ForLoop(t._id, t._prefix, t._markers, t._control, body); + } + } + } + +} + +export class ForLoopControl extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, init: JRightPadded[], condition: JRightPadded, update: JRightPadded[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._init = init; + this._condition = condition; + this._update = update; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ForLoopControl { + return id === this._id ? this : new ForLoopControl(id, this._prefix, this._markers, this._init, this._condition, this._update); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ForLoopControl { + return prefix === this._prefix ? this : new ForLoopControl(this._id, prefix, this._markers, this._init, this._condition, this._update); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ForLoopControl { + return markers === this._markers ? this : new ForLoopControl(this._id, this._prefix, markers, this._init, this._condition, this._update); + } + + private readonly _init: JRightPadded[]; + + public get init(): Statement[] { + return JRightPadded.getElements(this._init); + } + + public withInit(init: Statement[]): ForLoopControl { + return this.padding.withInit(JRightPadded.withElements(this._init, init)); + } + + private readonly _condition: JRightPadded; + + public get condition(): Expression { + return this._condition.element; + } + + public withCondition(condition: Expression): ForLoopControl { + return this.padding.withCondition(JRightPadded.withElement(this._condition, condition)); + } + + private readonly _update: JRightPadded[]; + + public get update(): Statement[] { + return JRightPadded.getElements(this._update); + } + + public withUpdate(update: Statement[]): ForLoopControl { + return this.padding.withUpdate(JRightPadded.withElements(this._update, update)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitForControl(this, p); + } + + get padding() { + const t = this; + return new class { + public get init(): JRightPadded[] { + return t._init; + } + public withInit(init: JRightPadded[]): ForLoopControl { + return t._init === init ? t : new ForLoopControl(t._id, t._prefix, t._markers, init, t._condition, t._update); + } + public get condition(): JRightPadded { + return t._condition; + } + public withCondition(condition: JRightPadded): ForLoopControl { + return t._condition === condition ? t : new ForLoopControl(t._id, t._prefix, t._markers, t._init, condition, t._update); + } + public get update(): JRightPadded[] { + return t._update; + } + public withUpdate(update: JRightPadded[]): ForLoopControl { + return t._update === update ? t : new ForLoopControl(t._id, t._prefix, t._markers, t._init, t._condition, update); + } + } + } + +} + +export class ParenthesizedTypeTree extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], parenthesizedType: Parentheses) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._parenthesizedType = parenthesizedType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ParenthesizedTypeTree { + return id === this._id ? this : new ParenthesizedTypeTree(id, this._prefix, this._markers, this._annotations, this._parenthesizedType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ParenthesizedTypeTree { + return prefix === this._prefix ? this : new ParenthesizedTypeTree(this._id, prefix, this._markers, this._annotations, this._parenthesizedType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ParenthesizedTypeTree { + return markers === this._markers ? this : new ParenthesizedTypeTree(this._id, this._prefix, markers, this._annotations, this._parenthesizedType); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): ParenthesizedTypeTree { + return annotations === this._annotations ? this : new ParenthesizedTypeTree(this._id, this._prefix, this._markers, annotations, this._parenthesizedType); + } + + private readonly _parenthesizedType: Parentheses; + + public get parenthesizedType(): Parentheses { + return this._parenthesizedType; + } + + public withParenthesizedType(parenthesizedType: Parentheses): ParenthesizedTypeTree { + return parenthesizedType === this._parenthesizedType ? this : new ParenthesizedTypeTree(this._id, this._prefix, this._markers, this._annotations, parenthesizedType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitParenthesizedTypeTree(this, p); + } + +} + +export class Identifier extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], simpleName: string, _type: JavaType | null, fieldType: JavaType.Variable | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._simpleName = simpleName; + this.__type = _type; + this._fieldType = fieldType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Identifier { + return id === this._id ? this : new Identifier(id, this._prefix, this._markers, this._annotations, this._simpleName, this.__type, this._fieldType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Identifier { + return prefix === this._prefix ? this : new Identifier(this._id, prefix, this._markers, this._annotations, this._simpleName, this.__type, this._fieldType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Identifier { + return markers === this._markers ? this : new Identifier(this._id, this._prefix, markers, this._annotations, this._simpleName, this.__type, this._fieldType); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): Identifier { + return annotations === this._annotations ? this : new Identifier(this._id, this._prefix, this._markers, annotations, this._simpleName, this.__type, this._fieldType); + } + + private readonly _simpleName: string; + + public get simpleName(): string { + return this._simpleName; + } + + public withSimpleName(simpleName: string): Identifier { + return simpleName === this._simpleName ? this : new Identifier(this._id, this._prefix, this._markers, this._annotations, simpleName, this.__type, this._fieldType); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Identifier { + return _type === this.__type ? this : new Identifier(this._id, this._prefix, this._markers, this._annotations, this._simpleName, _type, this._fieldType); + } + + private readonly _fieldType: JavaType.Variable | null; + + public get fieldType(): JavaType.Variable | null { + return this._fieldType; + } + + public withFieldType(fieldType: JavaType.Variable | null): Identifier { + return fieldType === this._fieldType ? this : new Identifier(this._id, this._prefix, this._markers, this._annotations, this._simpleName, this.__type, fieldType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitIdentifier(this, p); + } + +} + +export class If extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, ifCondition: ControlParentheses, thenPart: JRightPadded, elsePart: IfElse | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._ifCondition = ifCondition; + this._thenPart = thenPart; + this._elsePart = elsePart; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): If { + return id === this._id ? this : new If(id, this._prefix, this._markers, this._ifCondition, this._thenPart, this._elsePart); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): If { + return prefix === this._prefix ? this : new If(this._id, prefix, this._markers, this._ifCondition, this._thenPart, this._elsePart); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): If { + return markers === this._markers ? this : new If(this._id, this._prefix, markers, this._ifCondition, this._thenPart, this._elsePart); + } + + private readonly _ifCondition: ControlParentheses; + + public get ifCondition(): ControlParentheses { + return this._ifCondition; + } + + public withIfCondition(ifCondition: ControlParentheses): If { + return ifCondition === this._ifCondition ? this : new If(this._id, this._prefix, this._markers, ifCondition, this._thenPart, this._elsePart); + } + + private readonly _thenPart: JRightPadded; + + public get thenPart(): Statement { + return this._thenPart.element; + } + + public withThenPart(thenPart: Statement): If { + return this.padding.withThenPart(JRightPadded.withElement(this._thenPart, thenPart)); + } + + private readonly _elsePart: IfElse | null; + + public get elsePart(): IfElse | null { + return this._elsePart; + } + + public withElsePart(elsePart: IfElse | null): If { + return elsePart === this._elsePart ? this : new If(this._id, this._prefix, this._markers, this._ifCondition, this._thenPart, elsePart); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitIf(this, p); + } + + get padding() { + const t = this; + return new class { + public get thenPart(): JRightPadded { + return t._thenPart; + } + public withThenPart(thenPart: JRightPadded): If { + return t._thenPart === thenPart ? t : new If(t._id, t._prefix, t._markers, t._ifCondition, thenPart, t._elsePart); + } + } + } + +} + +export class IfElse extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, body: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): IfElse { + return id === this._id ? this : new IfElse(id, this._prefix, this._markers, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): IfElse { + return prefix === this._prefix ? this : new IfElse(this._id, prefix, this._markers, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): IfElse { + return markers === this._markers ? this : new IfElse(this._id, this._prefix, markers, this._body); + } + + private readonly _body: JRightPadded; + + public get body(): Statement { + return this._body.element; + } + + public withBody(body: Statement): IfElse { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitElse(this, p); + } + + get padding() { + const t = this; + return new class { + public get body(): JRightPadded { + return t._body; + } + public withBody(body: JRightPadded): IfElse { + return t._body === body ? t : new IfElse(t._id, t._prefix, t._markers, body); + } + } + } + +} + +export class Import extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, _static: JLeftPadded, qualid: FieldAccess, alias: JLeftPadded | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this.__static = _static; + this._qualid = qualid; + this._alias = alias; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Import { + return id === this._id ? this : new Import(id, this._prefix, this._markers, this.__static, this._qualid, this._alias); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Import { + return prefix === this._prefix ? this : new Import(this._id, prefix, this._markers, this.__static, this._qualid, this._alias); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Import { + return markers === this._markers ? this : new Import(this._id, this._prefix, markers, this.__static, this._qualid, this._alias); + } + + private readonly __static: JLeftPadded; + + public get _static(): boolean { + return this.__static.element; + } + + public withStatic(_static: boolean): Import { + return this.padding.withStatic(JLeftPadded.withElement(this.__static, _static)); + } + + private readonly _qualid: FieldAccess; + + public get qualid(): FieldAccess { + return this._qualid; + } + + public withQualid(qualid: FieldAccess): Import { + return qualid === this._qualid ? this : new Import(this._id, this._prefix, this._markers, this.__static, qualid, this._alias); + } + + private readonly _alias: JLeftPadded | null; + + public get alias(): Identifier | null { + return this._alias === null ? null : this._alias.element; + } + + public withAlias(alias: Identifier | null): Import { + return this.padding.withAlias(JLeftPadded.withElement(this._alias, alias)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitImport(this, p); + } + + get padding() { + const t = this; + return new class { + public get _static(): JLeftPadded { + return t.__static; + } + public withStatic(_static: JLeftPadded): Import { + return t._static === _static ? t : new Import(t._id, t._prefix, t._markers, _static, t._qualid, t._alias); + } + public get alias(): JLeftPadded | null { + return t._alias; + } + public withAlias(alias: JLeftPadded | null): Import { + return t._alias === alias ? t : new Import(t._id, t._prefix, t._markers, t.__static, t._qualid, alias); + } + } + } + +} + +export class InstanceOf extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, expression: JRightPadded, clazz: J, pattern: J | null, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._expression = expression; + this._clazz = clazz; + this._pattern = pattern; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): InstanceOf { + return id === this._id ? this : new InstanceOf(id, this._prefix, this._markers, this._expression, this._clazz, this._pattern, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): InstanceOf { + return prefix === this._prefix ? this : new InstanceOf(this._id, prefix, this._markers, this._expression, this._clazz, this._pattern, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): InstanceOf { + return markers === this._markers ? this : new InstanceOf(this._id, this._prefix, markers, this._expression, this._clazz, this._pattern, this.__type); + } + + private readonly _expression: JRightPadded; + + public get expression(): Expression { + return this._expression.element; + } + + public withExpression(expression: Expression): InstanceOf { + return this.padding.withExpression(JRightPadded.withElement(this._expression, expression)); + } + + private readonly _clazz: J; + + public get clazz(): J { + return this._clazz; + } + + public withClazz(clazz: J): InstanceOf { + return clazz === this._clazz ? this : new InstanceOf(this._id, this._prefix, this._markers, this._expression, clazz, this._pattern, this.__type); + } + + private readonly _pattern: J | null; + + public get pattern(): J | null { + return this._pattern; + } + + public withPattern(pattern: J | null): InstanceOf { + return pattern === this._pattern ? this : new InstanceOf(this._id, this._prefix, this._markers, this._expression, this._clazz, pattern, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): InstanceOf { + return _type === this.__type ? this : new InstanceOf(this._id, this._prefix, this._markers, this._expression, this._clazz, this._pattern, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitInstanceOf(this, p); + } + + get padding() { + const t = this; + return new class { + public get expression(): JRightPadded { + return t._expression; + } + public withExpression(expression: JRightPadded): InstanceOf { + return t._expression === expression ? t : new InstanceOf(t._id, t._prefix, t._markers, expression, t._clazz, t._pattern, t.__type); + } + } + } + +} + +export class IntersectionType extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, bounds: JContainer) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._bounds = bounds; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): IntersectionType { + return id === this._id ? this : new IntersectionType(id, this._prefix, this._markers, this._bounds); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): IntersectionType { + return prefix === this._prefix ? this : new IntersectionType(this._id, prefix, this._markers, this._bounds); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): IntersectionType { + return markers === this._markers ? this : new IntersectionType(this._id, this._prefix, markers, this._bounds); + } + + private readonly _bounds: JContainer; + + public get bounds(): TypeTree[] { + return this._bounds.elements; + } + + public withBounds(bounds: TypeTree[]): IntersectionType { + return this.padding.withBounds(JContainer.withElements(this._bounds, bounds)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitIntersectionType(this, p); + } + + get padding() { + const t = this; + return new class { + public get bounds(): JContainer { + return t._bounds; + } + public withBounds(bounds: JContainer): IntersectionType { + return t._bounds === bounds ? t : new IntersectionType(t._id, t._prefix, t._markers, bounds); + } + } + } + +} + +export class Label extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, label: JRightPadded, statement: Statement) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._label = label; + this._statement = statement; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Label { + return id === this._id ? this : new Label(id, this._prefix, this._markers, this._label, this._statement); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Label { + return prefix === this._prefix ? this : new Label(this._id, prefix, this._markers, this._label, this._statement); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Label { + return markers === this._markers ? this : new Label(this._id, this._prefix, markers, this._label, this._statement); + } + + private readonly _label: JRightPadded; + + public get label(): Identifier { + return this._label.element; + } + + public withLabel(label: Identifier): Label { + return this.padding.withLabel(JRightPadded.withElement(this._label, label)); + } + + private readonly _statement: Statement; + + public get statement(): Statement { + return this._statement; + } + + public withStatement(statement: Statement): Label { + return statement === this._statement ? this : new Label(this._id, this._prefix, this._markers, this._label, statement); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitLabel(this, p); + } + + get padding() { + const t = this; + return new class { + public get label(): JRightPadded { + return t._label; + } + public withLabel(label: JRightPadded): Label { + return t._label === label ? t : new Label(t._id, t._prefix, t._markers, label, t._statement); + } + } + } + +} + +export class Lambda extends J implements Statement, Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, parameters: LambdaParameters, arrow: Space, body: J, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._parameters = parameters; + this._arrow = arrow; + this._body = body; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Lambda { + return id === this._id ? this : new Lambda(id, this._prefix, this._markers, this._parameters, this._arrow, this._body, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Lambda { + return prefix === this._prefix ? this : new Lambda(this._id, prefix, this._markers, this._parameters, this._arrow, this._body, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Lambda { + return markers === this._markers ? this : new Lambda(this._id, this._prefix, markers, this._parameters, this._arrow, this._body, this.__type); + } + + private readonly _parameters: LambdaParameters; + + public get parameters(): LambdaParameters { + return this._parameters; + } + + public withParameters(parameters: LambdaParameters): Lambda { + return parameters === this._parameters ? this : new Lambda(this._id, this._prefix, this._markers, parameters, this._arrow, this._body, this.__type); + } + + private readonly _arrow: Space; + + public get arrow(): Space { + return this._arrow; + } + + public withArrow(arrow: Space): Lambda { + return arrow === this._arrow ? this : new Lambda(this._id, this._prefix, this._markers, this._parameters, arrow, this._body, this.__type); + } + + private readonly _body: J; + + public get body(): J { + return this._body; + } + + public withBody(body: J): Lambda { + return body === this._body ? this : new Lambda(this._id, this._prefix, this._markers, this._parameters, this._arrow, body, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Lambda { + return _type === this.__type ? this : new Lambda(this._id, this._prefix, this._markers, this._parameters, this._arrow, this._body, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitLambda(this, p); + } + +} + +export class LambdaParameters extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, parenthesized: boolean, parameters: JRightPadded[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._parenthesized = parenthesized; + this._parameters = parameters; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): LambdaParameters { + return id === this._id ? this : new LambdaParameters(id, this._prefix, this._markers, this._parenthesized, this._parameters); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): LambdaParameters { + return prefix === this._prefix ? this : new LambdaParameters(this._id, prefix, this._markers, this._parenthesized, this._parameters); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): LambdaParameters { + return markers === this._markers ? this : new LambdaParameters(this._id, this._prefix, markers, this._parenthesized, this._parameters); + } + + private readonly _parenthesized: boolean; + + public get parenthesized(): boolean { + return this._parenthesized; + } + + public withParenthesized(parenthesized: boolean): LambdaParameters { + return parenthesized === this._parenthesized ? this : new LambdaParameters(this._id, this._prefix, this._markers, parenthesized, this._parameters); + } + + private readonly _parameters: JRightPadded[]; + + public get parameters(): J[] { + return JRightPadded.getElements(this._parameters); + } + + public withParameters(parameters: J[]): LambdaParameters { + return this.padding.withParameters(JRightPadded.withElements(this._parameters, parameters)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitLambdaParameters(this, p); + } + + get padding() { + const t = this; + return new class { + public get parameters(): JRightPadded[] { + return t._parameters; + } + public withParameters(parameters: JRightPadded[]): LambdaParameters { + return t._parameters === parameters ? t : new LambdaParameters(t._id, t._prefix, t._markers, t._parenthesized, parameters); + } + } + } + +} + +export class Literal extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, value: Object | null, valueSource: string | null, unicodeEscapes: LiteralUnicodeEscape[] | null, _type: JavaType.Primitive) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._value = value; + this._valueSource = valueSource; + this._unicodeEscapes = unicodeEscapes; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Literal { + return id === this._id ? this : new Literal(id, this._prefix, this._markers, this._value, this._valueSource, this._unicodeEscapes, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Literal { + return prefix === this._prefix ? this : new Literal(this._id, prefix, this._markers, this._value, this._valueSource, this._unicodeEscapes, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Literal { + return markers === this._markers ? this : new Literal(this._id, this._prefix, markers, this._value, this._valueSource, this._unicodeEscapes, this.__type); + } + + private readonly _value: Object | null; + + public get value(): Object | null { + return this._value; + } + + public withValue(value: Object | null): Literal { + return value === this._value ? this : new Literal(this._id, this._prefix, this._markers, value, this._valueSource, this._unicodeEscapes, this.__type); + } + + private readonly _valueSource: string | null; + + public get valueSource(): string | null { + return this._valueSource; + } + + public withValueSource(valueSource: string | null): Literal { + return valueSource === this._valueSource ? this : new Literal(this._id, this._prefix, this._markers, this._value, valueSource, this._unicodeEscapes, this.__type); + } + + private readonly _unicodeEscapes: LiteralUnicodeEscape[] | null; + + public get unicodeEscapes(): LiteralUnicodeEscape[] | null { + return this._unicodeEscapes; + } + + public withUnicodeEscapes(unicodeEscapes: LiteralUnicodeEscape[] | null): Literal { + return unicodeEscapes === this._unicodeEscapes ? this : new Literal(this._id, this._prefix, this._markers, this._value, this._valueSource, unicodeEscapes, this.__type); + } + + private readonly __type: JavaType.Primitive; + + public get _type(): JavaType.Primitive { + return this.__type; + } + + public withType(_type: JavaType.Primitive): Literal { + return _type === this.__type ? this : new Literal(this._id, this._prefix, this._markers, this._value, this._valueSource, this._unicodeEscapes, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitLiteral(this, p); + } + +} + +class LiteralUnicodeEscape { + public constructor(valueSourceIndex: number, codePoint: string) { + this._valueSourceIndex = valueSourceIndex; + this._codePoint = codePoint; + } + + private readonly _valueSourceIndex: number; + + public get valueSourceIndex(): number { + return this._valueSourceIndex; + } + + public withValueSourceIndex(valueSourceIndex: number): LiteralUnicodeEscape { + return valueSourceIndex === this._valueSourceIndex ? this : new LiteralUnicodeEscape(valueSourceIndex, this._codePoint); + } + + private readonly _codePoint: string; + + public get codePoint(): string { + return this._codePoint; + } + + public withCodePoint(codePoint: string): LiteralUnicodeEscape { + return codePoint === this._codePoint ? this : new LiteralUnicodeEscape(this._valueSourceIndex, codePoint); + } + +} + +export class MemberReference extends J implements TypedTree, MethodCall { + public constructor(id: UUID, prefix: Space, markers: Markers, containing: JRightPadded, typeParameters: JContainer | null, reference: JLeftPadded, _type: JavaType | null, methodType: JavaType.Method | null, variableType: JavaType.Variable | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._containing = containing; + this._typeParameters = typeParameters; + this._reference = reference; + this.__type = _type; + this._methodType = methodType; + this._variableType = variableType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): MemberReference { + return id === this._id ? this : new MemberReference(id, this._prefix, this._markers, this._containing, this._typeParameters, this._reference, this.__type, this._methodType, this._variableType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): MemberReference { + return prefix === this._prefix ? this : new MemberReference(this._id, prefix, this._markers, this._containing, this._typeParameters, this._reference, this.__type, this._methodType, this._variableType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): MemberReference { + return markers === this._markers ? this : new MemberReference(this._id, this._prefix, markers, this._containing, this._typeParameters, this._reference, this.__type, this._methodType, this._variableType); + } + + private readonly _containing: JRightPadded; + + public get containing(): Expression { + return this._containing.element; + } + + public withContaining(containing: Expression): MemberReference { + return this.padding.withContaining(JRightPadded.withElement(this._containing, containing)); + } + + private readonly _typeParameters: JContainer | null; + + public get typeParameters(): Expression[] | null { + return this._typeParameters === null ? null : this._typeParameters.elements; + } + + public withTypeParameters(typeParameters: Expression[] | null): MemberReference { + return this.padding.withTypeParameters(JContainer.withElementsNullable(this._typeParameters, typeParameters)); + } + + private readonly _reference: JLeftPadded; + + public get reference(): Identifier { + return this._reference.element; + } + + public withReference(reference: Identifier): MemberReference { + return this.padding.withReference(JLeftPadded.withElement(this._reference, reference)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): MemberReference { + return _type === this.__type ? this : new MemberReference(this._id, this._prefix, this._markers, this._containing, this._typeParameters, this._reference, _type, this._methodType, this._variableType); + } + + private readonly _methodType: JavaType.Method | null; + + public get methodType(): JavaType.Method | null { + return this._methodType; + } + + public withMethodType(methodType: JavaType.Method | null): MemberReference { + return methodType === this._methodType ? this : new MemberReference(this._id, this._prefix, this._markers, this._containing, this._typeParameters, this._reference, this.__type, methodType, this._variableType); + } + + private readonly _variableType: JavaType.Variable | null; + + public get variableType(): JavaType.Variable | null { + return this._variableType; + } + + public withVariableType(variableType: JavaType.Variable | null): MemberReference { + return variableType === this._variableType ? this : new MemberReference(this._id, this._prefix, this._markers, this._containing, this._typeParameters, this._reference, this.__type, this._methodType, variableType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitMemberReference(this, p); + } + + get padding() { + const t = this; + return new class { + public get containing(): JRightPadded { + return t._containing; + } + public withContaining(containing: JRightPadded): MemberReference { + return t._containing === containing ? t : new MemberReference(t._id, t._prefix, t._markers, containing, t._typeParameters, t._reference, t.__type, t._methodType, t._variableType); + } + public get typeParameters(): JContainer | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: JContainer | null): MemberReference { + return t._typeParameters === typeParameters ? t : new MemberReference(t._id, t._prefix, t._markers, t._containing, typeParameters, t._reference, t.__type, t._methodType, t._variableType); + } + public get reference(): JLeftPadded { + return t._reference; + } + public withReference(reference: JLeftPadded): MemberReference { + return t._reference === reference ? t : new MemberReference(t._id, t._prefix, t._markers, t._containing, t._typeParameters, reference, t.__type, t._methodType, t._variableType); + } + } + } + +} + +export class MethodDeclaration extends J implements Statement, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, leadingAnnotations: Annotation[], modifiers: Modifier[], typeParameters: TypeParameters | null, returnTypeExpression: TypeTree | null, name: MethodDeclarationIdentifierWithAnnotations, parameters: JContainer, throws: JContainer | null, body: Block | null, defaultValue: JLeftPadded | null, methodType: JavaType.Method | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._leadingAnnotations = leadingAnnotations; + this._modifiers = modifiers; + this._typeParameters = typeParameters; + this._returnTypeExpression = returnTypeExpression; + this._name = name; + this._parameters = parameters; + this._throws = throws; + this._body = body; + this._defaultValue = defaultValue; + this._methodType = methodType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): MethodDeclaration { + return id === this._id ? this : new MethodDeclaration(id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): MethodDeclaration { + return prefix === this._prefix ? this : new MethodDeclaration(this._id, prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): MethodDeclaration { + return markers === this._markers ? this : new MethodDeclaration(this._id, this._prefix, markers, this._leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _leadingAnnotations: Annotation[]; + + public get leadingAnnotations(): Annotation[] { + return this._leadingAnnotations; + } + + public withLeadingAnnotations(leadingAnnotations: Annotation[]): MethodDeclaration { + return leadingAnnotations === this._leadingAnnotations ? this : new MethodDeclaration(this._id, this._prefix, this._markers, leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _modifiers: Modifier[]; + + public get modifiers(): Modifier[] { + return this._modifiers; + } + + public withModifiers(modifiers: Modifier[]): MethodDeclaration { + return modifiers === this._modifiers ? this : new MethodDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _typeParameters: TypeParameters | null; + + private readonly _returnTypeExpression: TypeTree | null; + + public get returnTypeExpression(): TypeTree | null { + return this._returnTypeExpression; + } + + public withReturnTypeExpression(returnTypeExpression: TypeTree | null): MethodDeclaration { + return returnTypeExpression === this._returnTypeExpression ? this : new MethodDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeParameters, returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, this._methodType); + } + + private readonly _name: MethodDeclarationIdentifierWithAnnotations; + + private readonly _parameters: JContainer; + + public get parameters(): Statement[] { + return this._parameters.elements; + } + + public withParameters(parameters: Statement[]): MethodDeclaration { + return this.padding.withParameters(JContainer.withElements(this._parameters, parameters)); + } + + private readonly _throws: JContainer | null; + + public get throws(): NameTree[] | null { + return this._throws === null ? null : this._throws.elements; + } + + public withThrows(throws: NameTree[] | null): MethodDeclaration { + return this.padding.withThrows(JContainer.withElementsNullable(this._throws, throws)); + } + + private readonly _body: Block | null; + + public get body(): Block | null { + return this._body; + } + + public withBody(body: Block | null): MethodDeclaration { + return body === this._body ? this : new MethodDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, body, this._defaultValue, this._methodType); + } + + private readonly _defaultValue: JLeftPadded | null; + + public get defaultValue(): Expression | null { + return this._defaultValue === null ? null : this._defaultValue.element; + } + + public withDefaultValue(defaultValue: Expression | null): MethodDeclaration { + return this.padding.withDefaultValue(JLeftPadded.withElement(this._defaultValue, defaultValue)); + } + + private readonly _methodType: JavaType.Method | null; + + public get methodType(): JavaType.Method | null { + return this._methodType; + } + + public withMethodType(methodType: JavaType.Method | null): MethodDeclaration { + return methodType === this._methodType ? this : new MethodDeclaration(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeParameters, this._returnTypeExpression, this._name, this._parameters, this._throws, this._body, this._defaultValue, methodType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitMethodDeclaration(this, p); + } + + get padding() { + const t = this; + return new class { + public get typeParameters(): TypeParameters | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: TypeParameters | null): MethodDeclaration { + return t._typeParameters === typeParameters ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, typeParameters, t._returnTypeExpression, t._name, t._parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get name(): MethodDeclarationIdentifierWithAnnotations { + return t._name; + } + public withName(name: MethodDeclarationIdentifierWithAnnotations): MethodDeclaration { + return t._name === name ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, name, t._parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get parameters(): JContainer { + return t._parameters; + } + public withParameters(parameters: JContainer): MethodDeclaration { + return t._parameters === parameters ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get throws(): JContainer | null { + return t._throws; + } + public withThrows(throws: JContainer | null): MethodDeclaration { + return t._throws === throws ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, t._parameters, throws, t._body, t._defaultValue, t._methodType); + } + public get defaultValue(): JLeftPadded | null { + return t._defaultValue; + } + public withDefaultValue(defaultValue: JLeftPadded | null): MethodDeclaration { + return t._defaultValue === defaultValue ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, t._parameters, t._throws, t._body, defaultValue, t._methodType); + } + } + } + + get annotations() { + const t = this; + return new class { + public get typeParameters(): TypeParameters | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: TypeParameters | null): MethodDeclaration { + return t._typeParameters === typeParameters ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, typeParameters, t._returnTypeExpression, t._name, t._parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get name(): MethodDeclarationIdentifierWithAnnotations { + return t._name; + } + public withName(name: MethodDeclarationIdentifierWithAnnotations): MethodDeclaration { + return t._name === name ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, name, t._parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get parameters(): JContainer { + return t._parameters; + } + public withParameters(parameters: JContainer): MethodDeclaration { + return t._parameters === parameters ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, parameters, t._throws, t._body, t._defaultValue, t._methodType); + } + public get throws(): JContainer | null { + return t._throws; + } + public withThrows(throws: JContainer | null): MethodDeclaration { + return t._throws === throws ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, t._parameters, throws, t._body, t._defaultValue, t._methodType); + } + public get defaultValue(): JLeftPadded | null { + return t._defaultValue; + } + public withDefaultValue(defaultValue: JLeftPadded | null): MethodDeclaration { + return t._defaultValue === defaultValue ? t : new MethodDeclaration(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeParameters, t._returnTypeExpression, t._name, t._parameters, t._throws, t._body, defaultValue, t._methodType); + } + } + } + +} + +class MethodDeclarationIdentifierWithAnnotations { + public constructor(identifier: Identifier, annotations: Annotation[]) { + this._identifier = identifier; + this._annotations = annotations; + } + + private readonly _identifier: Identifier; + + public get identifier(): Identifier { + return this._identifier; + } + + public withIdentifier(identifier: Identifier): MethodDeclarationIdentifierWithAnnotations { + return identifier === this._identifier ? this : new MethodDeclarationIdentifierWithAnnotations(identifier, this._annotations); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): MethodDeclarationIdentifierWithAnnotations { + return annotations === this._annotations ? this : new MethodDeclarationIdentifierWithAnnotations(this._identifier, annotations); + } + +} + +export class MethodInvocation extends J implements Statement, TypedTree, MethodCall { + public constructor(id: UUID, prefix: Space, markers: Markers, select: JRightPadded | null, typeParameters: JContainer | null, name: Identifier, _arguments: JContainer, methodType: JavaType.Method | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._select = select; + this._typeParameters = typeParameters; + this._name = name; + this.__arguments = _arguments; + this._methodType = methodType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): MethodInvocation { + return id === this._id ? this : new MethodInvocation(id, this._prefix, this._markers, this._select, this._typeParameters, this._name, this.__arguments, this._methodType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): MethodInvocation { + return prefix === this._prefix ? this : new MethodInvocation(this._id, prefix, this._markers, this._select, this._typeParameters, this._name, this.__arguments, this._methodType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): MethodInvocation { + return markers === this._markers ? this : new MethodInvocation(this._id, this._prefix, markers, this._select, this._typeParameters, this._name, this.__arguments, this._methodType); + } + + private readonly _select: JRightPadded | null; + + public get select(): Expression | null { + return this._select === null ? null : this._select.element; + } + + public withSelect(select: Expression | null): MethodInvocation { + return this.padding.withSelect(JRightPadded.withElement(this._select, select)); + } + + private readonly _typeParameters: JContainer | null; + + public get typeParameters(): Expression[] | null { + return this._typeParameters === null ? null : this._typeParameters.elements; + } + + public withTypeParameters(typeParameters: Expression[] | null): MethodInvocation { + return this.padding.withTypeParameters(JContainer.withElementsNullable(this._typeParameters, typeParameters)); + } + + private readonly _name: Identifier; + + public get name(): Identifier { + return this._name; + } + + public withName(name: Identifier): MethodInvocation { + return extensions.withName(this, name); + } + + private readonly __arguments: JContainer; + + public get _arguments(): Expression[] { + return this.__arguments.elements; + } + + public withArguments(_arguments: Expression[]): MethodInvocation { + return this.padding.withArguments(JContainer.withElements(this.__arguments, _arguments)); + } + + private readonly _methodType: JavaType.Method | null; + + public get methodType(): JavaType.Method | null { + return this._methodType; + } + + public withMethodType(methodType: JavaType.Method | null): MethodInvocation { + return methodType === this._methodType ? this : new MethodInvocation(this._id, this._prefix, this._markers, this._select, this._typeParameters, this._name, this.__arguments, methodType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitMethodInvocation(this, p); + } + + get padding() { + const t = this; + return new class { + public get select(): JRightPadded | null { + return t._select; + } + public withSelect(select: JRightPadded | null): MethodInvocation { + return t._select === select ? t : new MethodInvocation(t._id, t._prefix, t._markers, select, t._typeParameters, t._name, t.__arguments, t._methodType); + } + public get typeParameters(): JContainer | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: JContainer | null): MethodInvocation { + return t._typeParameters === typeParameters ? t : new MethodInvocation(t._id, t._prefix, t._markers, t._select, typeParameters, t._name, t.__arguments, t._methodType); + } + public get _arguments(): JContainer { + return t.__arguments; + } + public withArguments(_arguments: JContainer): MethodInvocation { + return t._arguments === _arguments ? t : new MethodInvocation(t._id, t._prefix, t._markers, t._select, t._typeParameters, t._name, _arguments, t._methodType); + } + } + } + +} + +export class Modifier extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, keyword: string | null, _type: ModifierType, annotations: Annotation[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._keyword = keyword; + this.__type = _type; + this._annotations = annotations; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Modifier { + return id === this._id ? this : new Modifier(id, this._prefix, this._markers, this._keyword, this.__type, this._annotations); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Modifier { + return prefix === this._prefix ? this : new Modifier(this._id, prefix, this._markers, this._keyword, this.__type, this._annotations); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Modifier { + return markers === this._markers ? this : new Modifier(this._id, this._prefix, markers, this._keyword, this.__type, this._annotations); + } + + private readonly _keyword: string | null; + + public get keyword(): string | null { + return this._keyword; + } + + public withKeyword(keyword: string | null): Modifier { + return keyword === this._keyword ? this : new Modifier(this._id, this._prefix, this._markers, keyword, this.__type, this._annotations); + } + + private readonly __type: ModifierType; + + public get _type(): ModifierType { + return this.__type; + } + + public withType(_type: ModifierType): Modifier { + return _type === this.__type ? this : new Modifier(this._id, this._prefix, this._markers, this._keyword, _type, this._annotations); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): Modifier { + return annotations === this._annotations ? this : new Modifier(this._id, this._prefix, this._markers, this._keyword, this.__type, annotations); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitModifier(this, p); + } + +} + +enum ModifierType { + Default = 0, + Public = 1, + Protected = 2, + Private = 3, + Abstract = 4, + Static = 5, + Final = 6, + Sealed = 7, + NonSealed = 8, + Transient = 9, + Volatile = 10, + Synchronized = 11, + Native = 12, + Strictfp = 13, + Async = 14, + Reified = 15, + Inline = 16, + LanguageExtension = 17, + +} + +export class MultiCatch extends J implements TypeTree { + public constructor(id: UUID, prefix: Space, markers: Markers, alternatives: JRightPadded[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._alternatives = alternatives; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): MultiCatch { + return id === this._id ? this : new MultiCatch(id, this._prefix, this._markers, this._alternatives); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): MultiCatch { + return prefix === this._prefix ? this : new MultiCatch(this._id, prefix, this._markers, this._alternatives); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): MultiCatch { + return markers === this._markers ? this : new MultiCatch(this._id, this._prefix, markers, this._alternatives); + } + + private readonly _alternatives: JRightPadded[]; + + public get alternatives(): NameTree[] { + return JRightPadded.getElements(this._alternatives); + } + + public withAlternatives(alternatives: NameTree[]): MultiCatch { + return this.padding.withAlternatives(JRightPadded.withElements(this._alternatives, alternatives)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitMultiCatch(this, p); + } + + get padding() { + const t = this; + return new class { + public get alternatives(): JRightPadded[] { + return t._alternatives; + } + public withAlternatives(alternatives: JRightPadded[]): MultiCatch { + return t._alternatives === alternatives ? t : new MultiCatch(t._id, t._prefix, t._markers, alternatives); + } + } + } + +} + +export class NewArray extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, typeExpression: TypeTree | null, dimensions: ArrayDimension[], initializer: JContainer | null, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._typeExpression = typeExpression; + this._dimensions = dimensions; + this._initializer = initializer; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): NewArray { + return id === this._id ? this : new NewArray(id, this._prefix, this._markers, this._typeExpression, this._dimensions, this._initializer, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): NewArray { + return prefix === this._prefix ? this : new NewArray(this._id, prefix, this._markers, this._typeExpression, this._dimensions, this._initializer, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): NewArray { + return markers === this._markers ? this : new NewArray(this._id, this._prefix, markers, this._typeExpression, this._dimensions, this._initializer, this.__type); + } + + private readonly _typeExpression: TypeTree | null; + + public get typeExpression(): TypeTree | null { + return this._typeExpression; + } + + public withTypeExpression(typeExpression: TypeTree | null): NewArray { + return typeExpression === this._typeExpression ? this : new NewArray(this._id, this._prefix, this._markers, typeExpression, this._dimensions, this._initializer, this.__type); + } + + private readonly _dimensions: ArrayDimension[]; + + public get dimensions(): ArrayDimension[] { + return this._dimensions; + } + + public withDimensions(dimensions: ArrayDimension[]): NewArray { + return dimensions === this._dimensions ? this : new NewArray(this._id, this._prefix, this._markers, this._typeExpression, dimensions, this._initializer, this.__type); + } + + private readonly _initializer: JContainer | null; + + public get initializer(): Expression[] | null { + return this._initializer === null ? null : this._initializer.elements; + } + + public withInitializer(initializer: Expression[] | null): NewArray { + return this.padding.withInitializer(JContainer.withElementsNullable(this._initializer, initializer)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): NewArray { + return _type === this.__type ? this : new NewArray(this._id, this._prefix, this._markers, this._typeExpression, this._dimensions, this._initializer, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitNewArray(this, p); + } + + get padding() { + const t = this; + return new class { + public get initializer(): JContainer | null { + return t._initializer; + } + public withInitializer(initializer: JContainer | null): NewArray { + return t._initializer === initializer ? t : new NewArray(t._id, t._prefix, t._markers, t._typeExpression, t._dimensions, initializer, t.__type); + } + } + } + +} + +export class ArrayDimension extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, index: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._index = index; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ArrayDimension { + return id === this._id ? this : new ArrayDimension(id, this._prefix, this._markers, this._index); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ArrayDimension { + return prefix === this._prefix ? this : new ArrayDimension(this._id, prefix, this._markers, this._index); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ArrayDimension { + return markers === this._markers ? this : new ArrayDimension(this._id, this._prefix, markers, this._index); + } + + private readonly _index: JRightPadded; + + public get index(): Expression { + return this._index.element; + } + + public withIndex(index: Expression): ArrayDimension { + return this.padding.withIndex(JRightPadded.withElement(this._index, index)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitArrayDimension(this, p); + } + + get padding() { + const t = this; + return new class { + public get index(): JRightPadded { + return t._index; + } + public withIndex(index: JRightPadded): ArrayDimension { + return t._index === index ? t : new ArrayDimension(t._id, t._prefix, t._markers, index); + } + } + } + +} + +export class NewClass extends J implements Statement, TypedTree, MethodCall { + public constructor(id: UUID, prefix: Space, markers: Markers, enclosing: JRightPadded | null, _new: Space, clazz: TypeTree | null, _arguments: JContainer, body: Block | null, constructorType: JavaType.Method | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._enclosing = enclosing; + this.__new = _new; + this._clazz = clazz; + this.__arguments = _arguments; + this._body = body; + this._constructorType = constructorType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): NewClass { + return id === this._id ? this : new NewClass(id, this._prefix, this._markers, this._enclosing, this.__new, this._clazz, this.__arguments, this._body, this._constructorType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): NewClass { + return prefix === this._prefix ? this : new NewClass(this._id, prefix, this._markers, this._enclosing, this.__new, this._clazz, this.__arguments, this._body, this._constructorType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): NewClass { + return markers === this._markers ? this : new NewClass(this._id, this._prefix, markers, this._enclosing, this.__new, this._clazz, this.__arguments, this._body, this._constructorType); + } + + private readonly _enclosing: JRightPadded | null; + + public get enclosing(): Expression | null { + return this._enclosing === null ? null : this._enclosing.element; + } + + public withEnclosing(enclosing: Expression | null): NewClass { + return this.padding.withEnclosing(JRightPadded.withElement(this._enclosing, enclosing)); + } + + private readonly __new: Space; + + public get _new(): Space { + return this.__new; + } + + public withNew(_new: Space): NewClass { + return _new === this.__new ? this : new NewClass(this._id, this._prefix, this._markers, this._enclosing, _new, this._clazz, this.__arguments, this._body, this._constructorType); + } + + private readonly _clazz: TypeTree | null; + + public get clazz(): TypeTree | null { + return this._clazz; + } + + public withClazz(clazz: TypeTree | null): NewClass { + return clazz === this._clazz ? this : new NewClass(this._id, this._prefix, this._markers, this._enclosing, this.__new, clazz, this.__arguments, this._body, this._constructorType); + } + + private readonly __arguments: JContainer; + + public get _arguments(): Expression[] { + return this.__arguments.elements; + } + + public withArguments(_arguments: Expression[]): NewClass { + return this.padding.withArguments(JContainer.withElements(this.__arguments, _arguments)); + } + + private readonly _body: Block | null; + + public get body(): Block | null { + return this._body; + } + + public withBody(body: Block | null): NewClass { + return body === this._body ? this : new NewClass(this._id, this._prefix, this._markers, this._enclosing, this.__new, this._clazz, this.__arguments, body, this._constructorType); + } + + private readonly _constructorType: JavaType.Method | null; + + public get constructorType(): JavaType.Method | null { + return this._constructorType; + } + + public withConstructorType(constructorType: JavaType.Method | null): NewClass { + return constructorType === this._constructorType ? this : new NewClass(this._id, this._prefix, this._markers, this._enclosing, this.__new, this._clazz, this.__arguments, this._body, constructorType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitNewClass(this, p); + } + + get padding() { + const t = this; + return new class { + public get enclosing(): JRightPadded | null { + return t._enclosing; + } + public withEnclosing(enclosing: JRightPadded | null): NewClass { + return t._enclosing === enclosing ? t : new NewClass(t._id, t._prefix, t._markers, enclosing, t.__new, t._clazz, t.__arguments, t._body, t._constructorType); + } + public get _arguments(): JContainer { + return t.__arguments; + } + public withArguments(_arguments: JContainer): NewClass { + return t._arguments === _arguments ? t : new NewClass(t._id, t._prefix, t._markers, t._enclosing, t.__new, t._clazz, _arguments, t._body, t._constructorType); + } + } + } + +} + +export class NullableType extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], typeTree: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._typeTree = typeTree; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): NullableType { + return id === this._id ? this : new NullableType(id, this._prefix, this._markers, this._annotations, this._typeTree); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): NullableType { + return prefix === this._prefix ? this : new NullableType(this._id, prefix, this._markers, this._annotations, this._typeTree); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): NullableType { + return markers === this._markers ? this : new NullableType(this._id, this._prefix, markers, this._annotations, this._typeTree); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): NullableType { + return annotations === this._annotations ? this : new NullableType(this._id, this._prefix, this._markers, annotations, this._typeTree); + } + + private readonly _typeTree: JRightPadded; + + public get typeTree(): TypeTree { + return this._typeTree.element; + } + + public withTypeTree(typeTree: TypeTree): NullableType { + return this.padding.withTypeTree(JRightPadded.withElement(this._typeTree, typeTree)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitNullableType(this, p); + } + + get padding() { + const t = this; + return new class { + public get typeTree(): JRightPadded { + return t._typeTree; + } + public withTypeTree(typeTree: JRightPadded): NullableType { + return t._typeTree === typeTree ? t : new NullableType(t._id, t._prefix, t._markers, t._annotations, typeTree); + } + } + } + +} + +export class Package extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, expression: Expression, annotations: Annotation[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._expression = expression; + this._annotations = annotations; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Package { + return id === this._id ? this : new Package(id, this._prefix, this._markers, this._expression, this._annotations); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Package { + return prefix === this._prefix ? this : new Package(this._id, prefix, this._markers, this._expression, this._annotations); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Package { + return markers === this._markers ? this : new Package(this._id, this._prefix, markers, this._expression, this._annotations); + } + + private readonly _expression: Expression; + + public get expression(): Expression { + return this._expression; + } + + public withExpression(expression: Expression): Package { + return expression === this._expression ? this : new Package(this._id, this._prefix, this._markers, expression, this._annotations); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): Package { + return annotations === this._annotations ? this : new Package(this._id, this._prefix, this._markers, this._expression, annotations); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitPackage(this, p); + } + +} + +export class ParameterizedType extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, clazz: NameTree, typeParameters: JContainer | null, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._clazz = clazz; + this._typeParameters = typeParameters; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ParameterizedType { + return id === this._id ? this : new ParameterizedType(id, this._prefix, this._markers, this._clazz, this._typeParameters, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ParameterizedType { + return prefix === this._prefix ? this : new ParameterizedType(this._id, prefix, this._markers, this._clazz, this._typeParameters, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ParameterizedType { + return markers === this._markers ? this : new ParameterizedType(this._id, this._prefix, markers, this._clazz, this._typeParameters, this.__type); + } + + private readonly _clazz: NameTree; + + public get clazz(): NameTree { + return this._clazz; + } + + public withClazz(clazz: NameTree): ParameterizedType { + return clazz === this._clazz ? this : new ParameterizedType(this._id, this._prefix, this._markers, clazz, this._typeParameters, this.__type); + } + + private readonly _typeParameters: JContainer | null; + + public get typeParameters(): Expression[] | null { + return this._typeParameters === null ? null : this._typeParameters.elements; + } + + public withTypeParameters(typeParameters: Expression[] | null): ParameterizedType { + return this.padding.withTypeParameters(JContainer.withElementsNullable(this._typeParameters, typeParameters)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): ParameterizedType { + return _type === this.__type ? this : new ParameterizedType(this._id, this._prefix, this._markers, this._clazz, this._typeParameters, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitParameterizedType(this, p); + } + + get padding() { + const t = this; + return new class { + public get typeParameters(): JContainer | null { + return t._typeParameters; + } + public withTypeParameters(typeParameters: JContainer | null): ParameterizedType { + return t._typeParameters === typeParameters ? t : new ParameterizedType(t._id, t._prefix, t._markers, t._clazz, typeParameters, t.__type); + } + } + } + +} + +export class Parentheses extends J implements Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, tree: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._tree = tree; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Parentheses { + return id === this._id ? this : new Parentheses(id, this._prefix, this._markers, this._tree); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Parentheses { + return prefix === this._prefix ? this : new Parentheses(this._id, prefix, this._markers, this._tree); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Parentheses { + return markers === this._markers ? this : new Parentheses(this._id, this._prefix, markers, this._tree); + } + + private readonly _tree: JRightPadded; + + public get tree(): J2 { + return this._tree.element; + } + + public withTree(tree: J2): Parentheses { + return this.padding.withTree(JRightPadded.withElement(this._tree, tree)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitParentheses(this, p); + } + + get padding() { + const t = this; + return new class { + public get tree(): JRightPadded { + return t._tree; + } + public withTree(tree: JRightPadded): Parentheses { + return t._tree === tree ? t : new Parentheses(t._id, t._prefix, t._markers, tree); + } + } + } + +} + +export class ControlParentheses extends J implements Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, tree: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._tree = tree; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): ControlParentheses { + return id === this._id ? this : new ControlParentheses(id, this._prefix, this._markers, this._tree); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): ControlParentheses { + return prefix === this._prefix ? this : new ControlParentheses(this._id, prefix, this._markers, this._tree); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): ControlParentheses { + return markers === this._markers ? this : new ControlParentheses(this._id, this._prefix, markers, this._tree); + } + + private readonly _tree: JRightPadded; + + public get tree(): J2 { + return this._tree.element; + } + + public withTree(tree: J2): ControlParentheses { + return this.padding.withTree(JRightPadded.withElement(this._tree, tree)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitControlParentheses(this, p); + } + + get padding() { + const t = this; + return new class { + public get tree(): JRightPadded { + return t._tree; + } + public withTree(tree: JRightPadded): ControlParentheses { + return t._tree === tree ? t : new ControlParentheses(t._id, t._prefix, t._markers, tree); + } + } + } + +} + +export class Primitive extends J implements TypeTree, Expression { + public constructor(id: UUID, prefix: Space, markers: Markers, _type: JavaType.Primitive) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Primitive { + return id === this._id ? this : new Primitive(id, this._prefix, this._markers, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Primitive { + return prefix === this._prefix ? this : new Primitive(this._id, prefix, this._markers, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Primitive { + return markers === this._markers ? this : new Primitive(this._id, this._prefix, markers, this.__type); + } + + private readonly __type: JavaType.Primitive; + + public withType(_type: JavaType.Primitive): Primitive { + return _type === this.__type ? this : new Primitive(this._id, this._prefix, this._markers, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitPrimitive(this, p); + } + +} + +export class Return extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, expression: Expression | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._expression = expression; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Return { + return id === this._id ? this : new Return(id, this._prefix, this._markers, this._expression); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Return { + return prefix === this._prefix ? this : new Return(this._id, prefix, this._markers, this._expression); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Return { + return markers === this._markers ? this : new Return(this._id, this._prefix, markers, this._expression); + } + + private readonly _expression: Expression | null; + + public get expression(): Expression | null { + return this._expression; + } + + public withExpression(expression: Expression | null): Return { + return expression === this._expression ? this : new Return(this._id, this._prefix, this._markers, expression); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitReturn(this, p); + } + +} + +export class Switch extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, selector: ControlParentheses, cases: Block) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._selector = selector; + this._cases = cases; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Switch { + return id === this._id ? this : new Switch(id, this._prefix, this._markers, this._selector, this._cases); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Switch { + return prefix === this._prefix ? this : new Switch(this._id, prefix, this._markers, this._selector, this._cases); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Switch { + return markers === this._markers ? this : new Switch(this._id, this._prefix, markers, this._selector, this._cases); + } + + private readonly _selector: ControlParentheses; + + public get selector(): ControlParentheses { + return this._selector; + } + + public withSelector(selector: ControlParentheses): Switch { + return selector === this._selector ? this : new Switch(this._id, this._prefix, this._markers, selector, this._cases); + } + + private readonly _cases: Block; + + public get cases(): Block { + return this._cases; + } + + public withCases(cases: Block): Switch { + return cases === this._cases ? this : new Switch(this._id, this._prefix, this._markers, this._selector, cases); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitSwitch(this, p); + } + +} + +export class SwitchExpression extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, selector: ControlParentheses, cases: Block) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._selector = selector; + this._cases = cases; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): SwitchExpression { + return id === this._id ? this : new SwitchExpression(id, this._prefix, this._markers, this._selector, this._cases); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): SwitchExpression { + return prefix === this._prefix ? this : new SwitchExpression(this._id, prefix, this._markers, this._selector, this._cases); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): SwitchExpression { + return markers === this._markers ? this : new SwitchExpression(this._id, this._prefix, markers, this._selector, this._cases); + } + + private readonly _selector: ControlParentheses; + + public get selector(): ControlParentheses { + return this._selector; + } + + public withSelector(selector: ControlParentheses): SwitchExpression { + return selector === this._selector ? this : new SwitchExpression(this._id, this._prefix, this._markers, selector, this._cases); + } + + private readonly _cases: Block; + + public get cases(): Block { + return this._cases; + } + + public withCases(cases: Block): SwitchExpression { + return cases === this._cases ? this : new SwitchExpression(this._id, this._prefix, this._markers, this._selector, cases); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitSwitchExpression(this, p); + } + +} + +export class Synchronized extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, lock: ControlParentheses, body: Block) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._lock = lock; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Synchronized { + return id === this._id ? this : new Synchronized(id, this._prefix, this._markers, this._lock, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Synchronized { + return prefix === this._prefix ? this : new Synchronized(this._id, prefix, this._markers, this._lock, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Synchronized { + return markers === this._markers ? this : new Synchronized(this._id, this._prefix, markers, this._lock, this._body); + } + + private readonly _lock: ControlParentheses; + + public get lock(): ControlParentheses { + return this._lock; + } + + public withLock(lock: ControlParentheses): Synchronized { + return lock === this._lock ? this : new Synchronized(this._id, this._prefix, this._markers, lock, this._body); + } + + private readonly _body: Block; + + public get body(): Block { + return this._body; + } + + public withBody(body: Block): Synchronized { + return body === this._body ? this : new Synchronized(this._id, this._prefix, this._markers, this._lock, body); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitSynchronized(this, p); + } + +} + +export class Ternary extends J implements Expression, Statement, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, condition: Expression, truePart: JLeftPadded, falsePart: JLeftPadded, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._condition = condition; + this._truePart = truePart; + this._falsePart = falsePart; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Ternary { + return id === this._id ? this : new Ternary(id, this._prefix, this._markers, this._condition, this._truePart, this._falsePart, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Ternary { + return prefix === this._prefix ? this : new Ternary(this._id, prefix, this._markers, this._condition, this._truePart, this._falsePart, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Ternary { + return markers === this._markers ? this : new Ternary(this._id, this._prefix, markers, this._condition, this._truePart, this._falsePart, this.__type); + } + + private readonly _condition: Expression; + + public get condition(): Expression { + return this._condition; + } + + public withCondition(condition: Expression): Ternary { + return condition === this._condition ? this : new Ternary(this._id, this._prefix, this._markers, condition, this._truePart, this._falsePart, this.__type); + } + + private readonly _truePart: JLeftPadded; + + public get truePart(): Expression { + return this._truePart.element; + } + + public withTruePart(truePart: Expression): Ternary { + return this.padding.withTruePart(JLeftPadded.withElement(this._truePart, truePart)); + } + + private readonly _falsePart: JLeftPadded; + + public get falsePart(): Expression { + return this._falsePart.element; + } + + public withFalsePart(falsePart: Expression): Ternary { + return this.padding.withFalsePart(JLeftPadded.withElement(this._falsePart, falsePart)); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Ternary { + return _type === this.__type ? this : new Ternary(this._id, this._prefix, this._markers, this._condition, this._truePart, this._falsePart, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTernary(this, p); + } + + get padding() { + const t = this; + return new class { + public get truePart(): JLeftPadded { + return t._truePart; + } + public withTruePart(truePart: JLeftPadded): Ternary { + return t._truePart === truePart ? t : new Ternary(t._id, t._prefix, t._markers, t._condition, truePart, t._falsePart, t.__type); + } + public get falsePart(): JLeftPadded { + return t._falsePart; + } + public withFalsePart(falsePart: JLeftPadded): Ternary { + return t._falsePart === falsePart ? t : new Ternary(t._id, t._prefix, t._markers, t._condition, t._truePart, falsePart, t.__type); + } + } + } + +} + +export class Throw extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, exception: Expression) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._exception = exception; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Throw { + return id === this._id ? this : new Throw(id, this._prefix, this._markers, this._exception); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Throw { + return prefix === this._prefix ? this : new Throw(this._id, prefix, this._markers, this._exception); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Throw { + return markers === this._markers ? this : new Throw(this._id, this._prefix, markers, this._exception); + } + + private readonly _exception: Expression; + + public get exception(): Expression { + return this._exception; + } + + public withException(exception: Expression): Throw { + return exception === this._exception ? this : new Throw(this._id, this._prefix, this._markers, exception); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitThrow(this, p); + } + +} + +export class Try extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, resources: JContainer | null, body: Block, catches: TryCatch[], _finally: JLeftPadded | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._resources = resources; + this._body = body; + this._catches = catches; + this.__finally = _finally; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Try { + return id === this._id ? this : new Try(id, this._prefix, this._markers, this._resources, this._body, this._catches, this.__finally); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Try { + return prefix === this._prefix ? this : new Try(this._id, prefix, this._markers, this._resources, this._body, this._catches, this.__finally); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Try { + return markers === this._markers ? this : new Try(this._id, this._prefix, markers, this._resources, this._body, this._catches, this.__finally); + } + + private readonly _resources: JContainer | null; + + public get resources(): TryResource[] | null { + return this._resources === null ? null : this._resources.elements; + } + + public withResources(resources: TryResource[] | null): Try { + return this.padding.withResources(JContainer.withElementsNullable(this._resources, resources)); + } + + private readonly _body: Block; + + public get body(): Block { + return this._body; + } + + public withBody(body: Block): Try { + return body === this._body ? this : new Try(this._id, this._prefix, this._markers, this._resources, body, this._catches, this.__finally); + } + + private readonly _catches: TryCatch[]; + + public get catches(): TryCatch[] { + return this._catches; + } + + public withCatches(catches: TryCatch[]): Try { + return catches === this._catches ? this : new Try(this._id, this._prefix, this._markers, this._resources, this._body, catches, this.__finally); + } + + private readonly __finally: JLeftPadded | null; + + public get _finally(): Block | null { + return this.__finally === null ? null : this.__finally.element; + } + + public withFinally(_finally: Block | null): Try { + return this.padding.withFinally(JLeftPadded.withElement(this.__finally, _finally)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTry(this, p); + } + + get padding() { + const t = this; + return new class { + public get resources(): JContainer | null { + return t._resources; + } + public withResources(resources: JContainer | null): Try { + return t._resources === resources ? t : new Try(t._id, t._prefix, t._markers, resources, t._body, t._catches, t.__finally); + } + public get _finally(): JLeftPadded | null { + return t.__finally; + } + public withFinally(_finally: JLeftPadded | null): Try { + return t._finally === _finally ? t : new Try(t._id, t._prefix, t._markers, t._resources, t._body, t._catches, _finally); + } + } + } + +} + +export class TryResource extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, variableDeclarations: TypedTree, terminatedWithSemicolon: boolean) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._variableDeclarations = variableDeclarations; + this._terminatedWithSemicolon = terminatedWithSemicolon; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): TryResource { + return id === this._id ? this : new TryResource(id, this._prefix, this._markers, this._variableDeclarations, this._terminatedWithSemicolon); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): TryResource { + return prefix === this._prefix ? this : new TryResource(this._id, prefix, this._markers, this._variableDeclarations, this._terminatedWithSemicolon); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): TryResource { + return markers === this._markers ? this : new TryResource(this._id, this._prefix, markers, this._variableDeclarations, this._terminatedWithSemicolon); + } + + private readonly _variableDeclarations: TypedTree; + + public get variableDeclarations(): TypedTree { + return this._variableDeclarations; + } + + public withVariableDeclarations(variableDeclarations: TypedTree): TryResource { + return variableDeclarations === this._variableDeclarations ? this : new TryResource(this._id, this._prefix, this._markers, variableDeclarations, this._terminatedWithSemicolon); + } + + private readonly _terminatedWithSemicolon: boolean; + + public get terminatedWithSemicolon(): boolean { + return this._terminatedWithSemicolon; + } + + public withTerminatedWithSemicolon(terminatedWithSemicolon: boolean): TryResource { + return terminatedWithSemicolon === this._terminatedWithSemicolon ? this : new TryResource(this._id, this._prefix, this._markers, this._variableDeclarations, terminatedWithSemicolon); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTryResource(this, p); + } + +} + +export class TryCatch extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, parameter: ControlParentheses, body: Block) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._parameter = parameter; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): TryCatch { + return id === this._id ? this : new TryCatch(id, this._prefix, this._markers, this._parameter, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): TryCatch { + return prefix === this._prefix ? this : new TryCatch(this._id, prefix, this._markers, this._parameter, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): TryCatch { + return markers === this._markers ? this : new TryCatch(this._id, this._prefix, markers, this._parameter, this._body); + } + + private readonly _parameter: ControlParentheses; + + public get parameter(): ControlParentheses { + return this._parameter; + } + + public withParameter(parameter: ControlParentheses): TryCatch { + return parameter === this._parameter ? this : new TryCatch(this._id, this._prefix, this._markers, parameter, this._body); + } + + private readonly _body: Block; + + public get body(): Block { + return this._body; + } + + public withBody(body: Block): TryCatch { + return body === this._body ? this : new TryCatch(this._id, this._prefix, this._markers, this._parameter, body); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitCatch(this, p); + } + +} + +export class TypeCast extends J implements Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, clazz: ControlParentheses, expression: Expression) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._clazz = clazz; + this._expression = expression; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): TypeCast { + return id === this._id ? this : new TypeCast(id, this._prefix, this._markers, this._clazz, this._expression); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): TypeCast { + return prefix === this._prefix ? this : new TypeCast(this._id, prefix, this._markers, this._clazz, this._expression); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): TypeCast { + return markers === this._markers ? this : new TypeCast(this._id, this._prefix, markers, this._clazz, this._expression); + } + + private readonly _clazz: ControlParentheses; + + public get clazz(): ControlParentheses { + return this._clazz; + } + + public withClazz(clazz: ControlParentheses): TypeCast { + return clazz === this._clazz ? this : new TypeCast(this._id, this._prefix, this._markers, clazz, this._expression); + } + + private readonly _expression: Expression; + + public get expression(): Expression { + return this._expression; + } + + public withExpression(expression: Expression): TypeCast { + return expression === this._expression ? this : new TypeCast(this._id, this._prefix, this._markers, this._clazz, expression); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTypeCast(this, p); + } + +} + +export class TypeParameter extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], modifiers: Modifier[], name: Expression, bounds: JContainer | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._modifiers = modifiers; + this._name = name; + this._bounds = bounds; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): TypeParameter { + return id === this._id ? this : new TypeParameter(id, this._prefix, this._markers, this._annotations, this._modifiers, this._name, this._bounds); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): TypeParameter { + return prefix === this._prefix ? this : new TypeParameter(this._id, prefix, this._markers, this._annotations, this._modifiers, this._name, this._bounds); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): TypeParameter { + return markers === this._markers ? this : new TypeParameter(this._id, this._prefix, markers, this._annotations, this._modifiers, this._name, this._bounds); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): TypeParameter { + return annotations === this._annotations ? this : new TypeParameter(this._id, this._prefix, this._markers, annotations, this._modifiers, this._name, this._bounds); + } + + private readonly _modifiers: Modifier[]; + + public get modifiers(): Modifier[] { + return this._modifiers; + } + + public withModifiers(modifiers: Modifier[]): TypeParameter { + return modifiers === this._modifiers ? this : new TypeParameter(this._id, this._prefix, this._markers, this._annotations, modifiers, this._name, this._bounds); + } + + private readonly _name: Expression; + + public get name(): Expression { + return this._name; + } + + public withName(name: Expression): TypeParameter { + return name === this._name ? this : new TypeParameter(this._id, this._prefix, this._markers, this._annotations, this._modifiers, name, this._bounds); + } + + private readonly _bounds: JContainer | null; + + public get bounds(): TypeTree[] | null { + return this._bounds === null ? null : this._bounds.elements; + } + + public withBounds(bounds: TypeTree[] | null): TypeParameter { + return this.padding.withBounds(JContainer.withElementsNullable(this._bounds, bounds)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTypeParameter(this, p); + } + + get padding() { + const t = this; + return new class { + public get bounds(): JContainer | null { + return t._bounds; + } + public withBounds(bounds: JContainer | null): TypeParameter { + return t._bounds === bounds ? t : new TypeParameter(t._id, t._prefix, t._markers, t._annotations, t._modifiers, t._name, bounds); + } + } + } + +} + +export class TypeParameters extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, annotations: Annotation[], typeParameters: JRightPadded[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._annotations = annotations; + this._typeParameters = typeParameters; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): TypeParameters { + return id === this._id ? this : new TypeParameters(id, this._prefix, this._markers, this._annotations, this._typeParameters); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): TypeParameters { + return prefix === this._prefix ? this : new TypeParameters(this._id, prefix, this._markers, this._annotations, this._typeParameters); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): TypeParameters { + return markers === this._markers ? this : new TypeParameters(this._id, this._prefix, markers, this._annotations, this._typeParameters); + } + + private readonly _annotations: Annotation[]; + + public get annotations(): Annotation[] { + return this._annotations; + } + + public withAnnotations(annotations: Annotation[]): TypeParameters { + return annotations === this._annotations ? this : new TypeParameters(this._id, this._prefix, this._markers, annotations, this._typeParameters); + } + + private readonly _typeParameters: JRightPadded[]; + + public get typeParameters(): TypeParameter[] { + return JRightPadded.getElements(this._typeParameters); + } + + public withTypeParameters(typeParameters: TypeParameter[]): TypeParameters { + return this.padding.withTypeParameters(JRightPadded.withElements(this._typeParameters, typeParameters)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitTypeParameters(this, p); + } + + get padding() { + const t = this; + return new class { + public get typeParameters(): JRightPadded[] { + return t._typeParameters; + } + public withTypeParameters(typeParameters: JRightPadded[]): TypeParameters { + return t._typeParameters === typeParameters ? t : new TypeParameters(t._id, t._prefix, t._markers, t._annotations, typeParameters); + } + } + } + +} + +export class Unary extends J implements Statement, Expression, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, operator: JLeftPadded, expression: Expression, _type: JavaType | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._operator = operator; + this._expression = expression; + this.__type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Unary { + return id === this._id ? this : new Unary(id, this._prefix, this._markers, this._operator, this._expression, this.__type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Unary { + return prefix === this._prefix ? this : new Unary(this._id, prefix, this._markers, this._operator, this._expression, this.__type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Unary { + return markers === this._markers ? this : new Unary(this._id, this._prefix, markers, this._operator, this._expression, this.__type); + } + + private readonly _operator: JLeftPadded; + + public get operator(): UnaryType { + return this._operator.element; + } + + public withOperator(operator: UnaryType): Unary { + return this.padding.withOperator(JLeftPadded.withElement(this._operator, operator)); + } + + private readonly _expression: Expression; + + public get expression(): Expression { + return this._expression; + } + + public withExpression(expression: Expression): Unary { + return expression === this._expression ? this : new Unary(this._id, this._prefix, this._markers, this._operator, expression, this.__type); + } + + private readonly __type: JavaType | null; + + public get _type(): JavaType | null { + return this.__type; + } + + public withType(_type: JavaType | null): Unary { + return _type === this.__type ? this : new Unary(this._id, this._prefix, this._markers, this._operator, this._expression, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitUnary(this, p); + } + + get padding() { + const t = this; + return new class { + public get operator(): JLeftPadded { + return t._operator; + } + public withOperator(operator: JLeftPadded): Unary { + return t._operator === operator ? t : new Unary(t._id, t._prefix, t._markers, operator, t._expression, t.__type); + } + } + } + +} + +enum UnaryType { + PreIncrement = 0, + PreDecrement = 1, + PostIncrement = 2, + PostDecrement = 3, + Positive = 4, + Negative = 5, + Complement = 6, + Not = 7, + +} + +export class VariableDeclarations extends J implements Statement, TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, leadingAnnotations: Annotation[], modifiers: Modifier[], typeExpression: TypeTree | null, varargs: Space | null, dimensionsBeforeName: JLeftPadded[], variables: JRightPadded[]) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._leadingAnnotations = leadingAnnotations; + this._modifiers = modifiers; + this._typeExpression = typeExpression; + this._varargs = varargs; + this._dimensionsBeforeName = dimensionsBeforeName; + this._variables = variables; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): VariableDeclarations { + return id === this._id ? this : new VariableDeclarations(id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): VariableDeclarations { + return prefix === this._prefix ? this : new VariableDeclarations(this._id, prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): VariableDeclarations { + return markers === this._markers ? this : new VariableDeclarations(this._id, this._prefix, markers, this._leadingAnnotations, this._modifiers, this._typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _leadingAnnotations: Annotation[]; + + public get leadingAnnotations(): Annotation[] { + return this._leadingAnnotations; + } + + public withLeadingAnnotations(leadingAnnotations: Annotation[]): VariableDeclarations { + return leadingAnnotations === this._leadingAnnotations ? this : new VariableDeclarations(this._id, this._prefix, this._markers, leadingAnnotations, this._modifiers, this._typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _modifiers: Modifier[]; + + public get modifiers(): Modifier[] { + return this._modifiers; + } + + public withModifiers(modifiers: Modifier[]): VariableDeclarations { + return modifiers === this._modifiers ? this : new VariableDeclarations(this._id, this._prefix, this._markers, this._leadingAnnotations, modifiers, this._typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _typeExpression: TypeTree | null; + + public get typeExpression(): TypeTree | null { + return this._typeExpression; + } + + public withTypeExpression(typeExpression: TypeTree | null): VariableDeclarations { + return typeExpression === this._typeExpression ? this : new VariableDeclarations(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, typeExpression, this._varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _varargs: Space | null; + + public get varargs(): Space | null { + return this._varargs; + } + + public withVarargs(varargs: Space | null): VariableDeclarations { + return varargs === this._varargs ? this : new VariableDeclarations(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeExpression, varargs, this._dimensionsBeforeName, this._variables); + } + + private readonly _dimensionsBeforeName: JLeftPadded[]; + + public get dimensionsBeforeName(): JLeftPadded[] { + return this._dimensionsBeforeName; + } + + public withDimensionsBeforeName(dimensionsBeforeName: JLeftPadded[]): VariableDeclarations { + return dimensionsBeforeName === this._dimensionsBeforeName ? this : new VariableDeclarations(this._id, this._prefix, this._markers, this._leadingAnnotations, this._modifiers, this._typeExpression, this._varargs, dimensionsBeforeName, this._variables); + } + + private readonly _variables: JRightPadded[]; + + public get variables(): VariableDeclarationsNamedVariable[] { + return JRightPadded.getElements(this._variables); + } + + public withVariables(variables: VariableDeclarationsNamedVariable[]): VariableDeclarations { + return this.padding.withVariables(JRightPadded.withElements(this._variables, variables)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitVariableDeclarations(this, p); + } + + get padding() { + const t = this; + return new class { + public get variables(): JRightPadded[] { + return t._variables; + } + public withVariables(variables: JRightPadded[]): VariableDeclarations { + return t._variables === variables ? t : new VariableDeclarations(t._id, t._prefix, t._markers, t._leadingAnnotations, t._modifiers, t._typeExpression, t._varargs, t._dimensionsBeforeName, variables); + } + } + } + +} + +export class VariableDeclarationsNamedVariable extends J implements NameTree { + public constructor(id: UUID, prefix: Space, markers: Markers, name: Identifier, dimensionsAfterName: JLeftPadded[], initializer: JLeftPadded | null, variableType: JavaType.Variable | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._name = name; + this._dimensionsAfterName = dimensionsAfterName; + this._initializer = initializer; + this._variableType = variableType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): VariableDeclarationsNamedVariable { + return id === this._id ? this : new VariableDeclarationsNamedVariable(id, this._prefix, this._markers, this._name, this._dimensionsAfterName, this._initializer, this._variableType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): VariableDeclarationsNamedVariable { + return prefix === this._prefix ? this : new VariableDeclarationsNamedVariable(this._id, prefix, this._markers, this._name, this._dimensionsAfterName, this._initializer, this._variableType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): VariableDeclarationsNamedVariable { + return markers === this._markers ? this : new VariableDeclarationsNamedVariable(this._id, this._prefix, markers, this._name, this._dimensionsAfterName, this._initializer, this._variableType); + } + + private readonly _name: Identifier; + + public get name(): Identifier { + return this._name; + } + + public withName(name: Identifier): VariableDeclarationsNamedVariable { + return name === this._name ? this : new VariableDeclarationsNamedVariable(this._id, this._prefix, this._markers, name, this._dimensionsAfterName, this._initializer, this._variableType); + } + + private readonly _dimensionsAfterName: JLeftPadded[]; + + public get dimensionsAfterName(): JLeftPadded[] { + return this._dimensionsAfterName; + } + + public withDimensionsAfterName(dimensionsAfterName: JLeftPadded[]): VariableDeclarationsNamedVariable { + return dimensionsAfterName === this._dimensionsAfterName ? this : new VariableDeclarationsNamedVariable(this._id, this._prefix, this._markers, this._name, dimensionsAfterName, this._initializer, this._variableType); + } + + private readonly _initializer: JLeftPadded | null; + + public get initializer(): Expression | null { + return this._initializer === null ? null : this._initializer.element; + } + + public withInitializer(initializer: Expression | null): VariableDeclarationsNamedVariable { + return this.padding.withInitializer(JLeftPadded.withElement(this._initializer, initializer)); + } + + private readonly _variableType: JavaType.Variable | null; + + public get variableType(): JavaType.Variable | null { + return this._variableType; + } + + public withVariableType(variableType: JavaType.Variable | null): VariableDeclarationsNamedVariable { + return variableType === this._variableType ? this : new VariableDeclarationsNamedVariable(this._id, this._prefix, this._markers, this._name, this._dimensionsAfterName, this._initializer, variableType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitVariable(this, p); + } + + get padding() { + const t = this; + return new class { + public get initializer(): JLeftPadded | null { + return t._initializer; + } + public withInitializer(initializer: JLeftPadded | null): VariableDeclarationsNamedVariable { + return t._initializer === initializer ? t : new VariableDeclarationsNamedVariable(t._id, t._prefix, t._markers, t._name, t._dimensionsAfterName, initializer, t._variableType); + } + } + } + +} + +export class WhileLoop extends J implements Loop { + public constructor(id: UUID, prefix: Space, markers: Markers, condition: ControlParentheses, body: JRightPadded) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._condition = condition; + this._body = body; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): WhileLoop { + return id === this._id ? this : new WhileLoop(id, this._prefix, this._markers, this._condition, this._body); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): WhileLoop { + return prefix === this._prefix ? this : new WhileLoop(this._id, prefix, this._markers, this._condition, this._body); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): WhileLoop { + return markers === this._markers ? this : new WhileLoop(this._id, this._prefix, markers, this._condition, this._body); + } + + private readonly _condition: ControlParentheses; + + public get condition(): ControlParentheses { + return this._condition; + } + + public withCondition(condition: ControlParentheses): WhileLoop { + return condition === this._condition ? this : new WhileLoop(this._id, this._prefix, this._markers, condition, this._body); + } + + private readonly _body: JRightPadded; + + public get body(): Statement { + return this._body.element; + } + + public withBody(body: Statement): WhileLoop { + return this.padding.withBody(JRightPadded.withElement(this._body, body)); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitWhileLoop(this, p); + } + + get padding() { + const t = this; + return new class { + public get body(): JRightPadded { + return t._body; + } + public withBody(body: JRightPadded): WhileLoop { + return t._body === body ? t : new WhileLoop(t._id, t._prefix, t._markers, t._condition, body); + } + } + } + +} + +export class Wildcard extends J implements Expression, TypeTree { + public constructor(id: UUID, prefix: Space, markers: Markers, bound: JLeftPadded | null, boundedType: NameTree | null) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._bound = bound; + this._boundedType = boundedType; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Wildcard { + return id === this._id ? this : new Wildcard(id, this._prefix, this._markers, this._bound, this._boundedType); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Wildcard { + return prefix === this._prefix ? this : new Wildcard(this._id, prefix, this._markers, this._bound, this._boundedType); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Wildcard { + return markers === this._markers ? this : new Wildcard(this._id, this._prefix, markers, this._bound, this._boundedType); + } + + private readonly _bound: JLeftPadded | null; + + public get bound(): WildcardBound | null { + return this._bound === null ? null : this._bound.element; + } + + public withBound(bound: WildcardBound | null): Wildcard { + return this.padding.withBound(JLeftPadded.withElement(this._bound, bound)); + } + + private readonly _boundedType: NameTree | null; + + public get boundedType(): NameTree | null { + return this._boundedType; + } + + public withBoundedType(boundedType: NameTree | null): Wildcard { + return boundedType === this._boundedType ? this : new Wildcard(this._id, this._prefix, this._markers, this._bound, boundedType); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitWildcard(this, p); + } + + get padding() { + const t = this; + return new class { + public get bound(): JLeftPadded | null { + return t._bound; + } + public withBound(bound: JLeftPadded | null): Wildcard { + return t._bound === bound ? t : new Wildcard(t._id, t._prefix, t._markers, bound, t._boundedType); + } + } + } + +} + +enum WildcardBound { + Extends = 0, + Super = 1, + +} + +export class Yield extends J implements Statement { + public constructor(id: UUID, prefix: Space, markers: Markers, implicit: boolean, value: Expression) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._implicit = implicit; + this._value = value; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Yield { + return id === this._id ? this : new Yield(id, this._prefix, this._markers, this._implicit, this._value); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Yield { + return prefix === this._prefix ? this : new Yield(this._id, prefix, this._markers, this._implicit, this._value); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Yield { + return markers === this._markers ? this : new Yield(this._id, this._prefix, markers, this._implicit, this._value); + } + + private readonly _implicit: boolean; + + public get implicit(): boolean { + return this._implicit; + } + + public withImplicit(implicit: boolean): Yield { + return implicit === this._implicit ? this : new Yield(this._id, this._prefix, this._markers, implicit, this._value); + } + + private readonly _value: Expression; + + public get value(): Expression { + return this._value; + } + + public withValue(value: Expression): Yield { + return value === this._value ? this : new Yield(this._id, this._prefix, this._markers, this._implicit, value); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitYield(this, p); + } + +} + +export class Unknown extends J implements Statement, Expression, TypeTree { + public constructor(id: UUID, prefix: Space, markers: Markers, source: UnknownSource) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._source = source; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): Unknown { + return id === this._id ? this : new Unknown(id, this._prefix, this._markers, this._source); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): Unknown { + return prefix === this._prefix ? this : new Unknown(this._id, prefix, this._markers, this._source); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): Unknown { + return markers === this._markers ? this : new Unknown(this._id, this._prefix, markers, this._source); + } + + private readonly _source: UnknownSource; + + public get source(): UnknownSource { + return this._source; + } + + public withSource(source: UnknownSource): Unknown { + return source === this._source ? this : new Unknown(this._id, this._prefix, this._markers, source); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitUnknown(this, p); + } + +} + +export class UnknownSource extends J { + public constructor(id: UUID, prefix: Space, markers: Markers, text: string) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._text = text; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): UnknownSource { + return id === this._id ? this : new UnknownSource(id, this._prefix, this._markers, this._text); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): UnknownSource { + return prefix === this._prefix ? this : new UnknownSource(this._id, prefix, this._markers, this._text); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): UnknownSource { + return markers === this._markers ? this : new UnknownSource(this._id, this._prefix, markers, this._text); + } + + private readonly _text: string; + + public get text(): string { + return this._text; + } + + public withText(text: string): UnknownSource { + return text === this._text ? this : new UnknownSource(this._id, this._prefix, this._markers, text); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitUnknownSource(this, p); + } + +} diff --git a/openrewrite/src/java/visitor.ts b/openrewrite/src/java/visitor.ts new file mode 100644 index 00000000..c124a7d6 --- /dev/null +++ b/openrewrite/src/java/visitor.ts @@ -0,0 +1,984 @@ +import * as extensions from "./extensions"; +import {ListUtils, SourceFile, Tree, TreeVisitor} from "../core"; +import {Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, J} from "./support_types"; +import * as java from "./tree"; + +export class JavaVisitor

extends TreeVisitor { + isAcceptable(sourceFile: SourceFile, p: P): boolean { + return sourceFile instanceof J; + } + + visitExpression(expression: Expression, p: P): J { + return expression; + } + + visitStatement(statement: Statement, p: P): J { + return statement; + } + + public visitAnnotatedType(annotatedType: java.AnnotatedType, p: P): J | null { + annotatedType = annotatedType.withPrefix(this.visitSpace(annotatedType.prefix, SpaceLocation.ANNOTATED_TYPE_PREFIX, p)!); + let tempExpression = this.visitExpression(annotatedType, p) as Expression; + if (!(tempExpression instanceof java.AnnotatedType)) + { + return tempExpression; + } + annotatedType = tempExpression as java.AnnotatedType; + annotatedType = annotatedType.withMarkers(this.visitMarkers(annotatedType.markers, p)); + annotatedType = annotatedType.withAnnotations(ListUtils.map(annotatedType.annotations, el => this.visit(el, p) as java.Annotation)); + annotatedType = annotatedType.withTypeExpression(this.visitAndCast(annotatedType.typeExpression, p)!); + return annotatedType; + } + + public visitAnnotation(annotation: java.Annotation, p: P): J | null { + annotation = annotation.withPrefix(this.visitSpace(annotation.prefix, SpaceLocation.ANNOTATION_PREFIX, p)!); + let tempExpression = this.visitExpression(annotation, p) as Expression; + if (!(tempExpression instanceof java.Annotation)) + { + return tempExpression; + } + annotation = tempExpression as java.Annotation; + annotation = annotation.withMarkers(this.visitMarkers(annotation.markers, p)); + annotation = annotation.withAnnotationType(this.visitAndCast(annotation.annotationType, p)!); + annotation = annotation.padding.withArguments(this.visitContainer(annotation.padding.arguments, JContainerLocation.ANNOTATION_ARGUMENTS, p)); + return annotation; + } + + public visitArrayAccess(arrayAccess: java.ArrayAccess, p: P): J | null { + arrayAccess = arrayAccess.withPrefix(this.visitSpace(arrayAccess.prefix, SpaceLocation.ARRAY_ACCESS_PREFIX, p)!); + let tempExpression = this.visitExpression(arrayAccess, p) as Expression; + if (!(tempExpression instanceof java.ArrayAccess)) + { + return tempExpression; + } + arrayAccess = tempExpression as java.ArrayAccess; + arrayAccess = arrayAccess.withMarkers(this.visitMarkers(arrayAccess.markers, p)); + arrayAccess = arrayAccess.withIndexed(this.visitAndCast(arrayAccess.indexed, p)!); + arrayAccess = arrayAccess.withDimension(this.visitAndCast(arrayAccess.dimension, p)!); + return arrayAccess; + } + + public visitArrayType(arrayType: java.ArrayType, p: P): J | null { + arrayType = arrayType.withPrefix(this.visitSpace(arrayType.prefix, SpaceLocation.ARRAY_TYPE_PREFIX, p)!); + let tempExpression = this.visitExpression(arrayType, p) as Expression; + if (!(tempExpression instanceof java.ArrayType)) + { + return tempExpression; + } + arrayType = tempExpression as java.ArrayType; + arrayType = arrayType.withMarkers(this.visitMarkers(arrayType.markers, p)); + arrayType = arrayType.withElementType(this.visitAndCast(arrayType.elementType, p)!); + arrayType = arrayType.withAnnotations(ListUtils.map(arrayType.annotations, el => this.visit(el, p) as java.Annotation)); + arrayType = arrayType.withDimension(this.visitLeftPadded(arrayType.dimension, JLeftPaddedLocation.ARRAY_TYPE_DIMENSION, p)); + return arrayType; + } + + public visitAssert(assert: java.Assert, p: P): J | null { + assert = assert.withPrefix(this.visitSpace(assert.prefix, SpaceLocation.ASSERT_PREFIX, p)!); + let tempStatement = this.visitStatement(assert, p) as Statement; + if (!(tempStatement instanceof java.Assert)) + { + return tempStatement; + } + assert = tempStatement as java.Assert; + assert = assert.withMarkers(this.visitMarkers(assert.markers, p)); + assert = assert.withCondition(this.visitAndCast(assert.condition, p)!); + assert = assert.withDetail(this.visitLeftPadded(assert.detail, JLeftPaddedLocation.ASSERT_DETAIL, p)); + return assert; + } + + public visitAssignment(assignment: java.Assignment, p: P): J | null { + assignment = assignment.withPrefix(this.visitSpace(assignment.prefix, SpaceLocation.ASSIGNMENT_PREFIX, p)!); + let tempStatement = this.visitStatement(assignment, p) as Statement; + if (!(tempStatement instanceof java.Assignment)) + { + return tempStatement; + } + assignment = tempStatement as java.Assignment; + let tempExpression = this.visitExpression(assignment, p) as Expression; + if (!(tempExpression instanceof java.Assignment)) + { + return tempExpression; + } + assignment = tempExpression as java.Assignment; + assignment = assignment.withMarkers(this.visitMarkers(assignment.markers, p)); + assignment = assignment.withVariable(this.visitAndCast(assignment.variable, p)!); + assignment = assignment.padding.withAssignment(this.visitLeftPadded(assignment.padding.assignment, JLeftPaddedLocation.ASSIGNMENT, p)!); + return assignment; + } + + public visitAssignmentOperation(assignmentOperation: java.AssignmentOperation, p: P): J | null { + assignmentOperation = assignmentOperation.withPrefix(this.visitSpace(assignmentOperation.prefix, SpaceLocation.ASSIGNMENT_OPERATION_PREFIX, p)!); + let tempStatement = this.visitStatement(assignmentOperation, p) as Statement; + if (!(tempStatement instanceof java.AssignmentOperation)) + { + return tempStatement; + } + assignmentOperation = tempStatement as java.AssignmentOperation; + let tempExpression = this.visitExpression(assignmentOperation, p) as Expression; + if (!(tempExpression instanceof java.AssignmentOperation)) + { + return tempExpression; + } + assignmentOperation = tempExpression as java.AssignmentOperation; + assignmentOperation = assignmentOperation.withMarkers(this.visitMarkers(assignmentOperation.markers, p)); + assignmentOperation = assignmentOperation.withVariable(this.visitAndCast(assignmentOperation.variable, p)!); + assignmentOperation = assignmentOperation.padding.withOperator(this.visitLeftPadded(assignmentOperation.padding.operator, JLeftPaddedLocation.ASSIGNMENT_OPERATION_OPERATOR, p)!); + assignmentOperation = assignmentOperation.withAssignment(this.visitAndCast(assignmentOperation.assignment, p)!); + return assignmentOperation; + } + + public visitBinary(binary: java.Binary, p: P): J | null { + binary = binary.withPrefix(this.visitSpace(binary.prefix, SpaceLocation.BINARY_PREFIX, p)!); + let tempExpression = this.visitExpression(binary, p) as Expression; + if (!(tempExpression instanceof java.Binary)) + { + return tempExpression; + } + binary = tempExpression as java.Binary; + binary = binary.withMarkers(this.visitMarkers(binary.markers, p)); + binary = binary.withLeft(this.visitAndCast(binary.left, p)!); + binary = binary.padding.withOperator(this.visitLeftPadded(binary.padding.operator, JLeftPaddedLocation.BINARY_OPERATOR, p)!); + binary = binary.withRight(this.visitAndCast(binary.right, p)!); + return binary; + } + + public visitBlock(block: java.Block, p: P): J | null { + block = block.withPrefix(this.visitSpace(block.prefix, SpaceLocation.BLOCK_PREFIX, p)!); + let tempStatement = this.visitStatement(block, p) as Statement; + if (!(tempStatement instanceof java.Block)) + { + return tempStatement; + } + block = tempStatement as java.Block; + block = block.withMarkers(this.visitMarkers(block.markers, p)); + block = block.padding.withStatic(this.visitRightPadded(block.padding.static, JRightPaddedLocation.STATIC_INIT, p)!); + block = block.padding.withStatements(ListUtils.map(block.padding.statements, el => this.visitRightPadded(el, JRightPaddedLocation.BLOCK_STATEMENT, p))); + block = block.withEnd(this.visitSpace(block.end, SpaceLocation.BLOCK_END, p)!); + return block; + } + + public visitBreak(_break: java.Break, p: P): J | null { + _break = _break.withPrefix(this.visitSpace(_break.prefix, SpaceLocation.BREAK_PREFIX, p)!); + let tempStatement = this.visitStatement(_break, p) as Statement; + if (!(tempStatement instanceof java.Break)) + { + return tempStatement; + } + _break = tempStatement as java.Break; + _break = _break.withMarkers(this.visitMarkers(_break.markers, p)); + _break = _break.withLabel(this.visitAndCast(_break.label, p)); + return _break; + } + + public visitCase(_case: java.Case, p: P): J | null { + _case = _case.withPrefix(this.visitSpace(_case.prefix, SpaceLocation.CASE_PREFIX, p)!); + let tempStatement = this.visitStatement(_case, p) as Statement; + if (!(tempStatement instanceof java.Case)) + { + return tempStatement; + } + _case = tempStatement as java.Case; + _case = _case.withMarkers(this.visitMarkers(_case.markers, p)); + _case = _case.padding.withExpressions(this.visitContainer(_case.padding.expressions, JContainerLocation.CASE_EXPRESSION, p)!); + _case = _case.padding.withStatements(this.visitContainer(_case.padding.statements, JContainerLocation.CASE, p)!); + _case = _case.padding.withBody(this.visitRightPadded(_case.padding.body, JRightPaddedLocation.CASE_BODY, p)); + return _case; + } + + public visitClassDeclaration(classDeclaration: java.ClassDeclaration, p: P): J | null { + classDeclaration = classDeclaration.withPrefix(this.visitSpace(classDeclaration.prefix, SpaceLocation.CLASS_DECLARATION_PREFIX, p)!); + let tempStatement = this.visitStatement(classDeclaration, p) as Statement; + if (!(tempStatement instanceof java.ClassDeclaration)) + { + return tempStatement; + } + classDeclaration = tempStatement as java.ClassDeclaration; + classDeclaration = classDeclaration.withMarkers(this.visitMarkers(classDeclaration.markers, p)); + classDeclaration = classDeclaration.withLeadingAnnotations(ListUtils.map(classDeclaration.leadingAnnotations, el => this.visit(el, p) as java.Annotation)); + classDeclaration = classDeclaration.withModifiers(ListUtils.map(classDeclaration.modifiers, el => this.visit(el, p) as java.Modifier)); + classDeclaration = classDeclaration.padding.withKind(this.visitAndCast(classDeclaration.padding.kind, p)!); + classDeclaration = classDeclaration.withName(this.visitAndCast(classDeclaration.name, p)!); + classDeclaration = classDeclaration.padding.withTypeParameters(this.visitContainer(classDeclaration.padding.typeParameters, JContainerLocation.TYPE_PARAMETERS, p)); + classDeclaration = classDeclaration.padding.withPrimaryConstructor(this.visitContainer(classDeclaration.padding.primaryConstructor, JContainerLocation.RECORD_STATE_VECTOR, p)); + classDeclaration = classDeclaration.padding.withExtends(this.visitLeftPadded(classDeclaration.padding.extends, JLeftPaddedLocation.EXTENDS, p)); + classDeclaration = classDeclaration.padding.withImplements(this.visitContainer(classDeclaration.padding.implements, JContainerLocation.IMPLEMENTS, p)); + classDeclaration = classDeclaration.padding.withPermits(this.visitContainer(classDeclaration.padding.permits, JContainerLocation.PERMITS, p)); + classDeclaration = classDeclaration.withBody(this.visitAndCast(classDeclaration.body, p)!); + return classDeclaration; + } + + public visitClassDeclarationKind(classDeclarationKind: java.ClassDeclarationKind, p: P): J | null { + classDeclarationKind = classDeclarationKind.withPrefix(this.visitSpace(classDeclarationKind.prefix, SpaceLocation.CLASS_KIND, p)!); + classDeclarationKind = classDeclarationKind.withMarkers(this.visitMarkers(classDeclarationKind.markers, p)); + classDeclarationKind = classDeclarationKind.withAnnotations(ListUtils.map(classDeclarationKind.annotations, el => this.visit(el, p) as java.Annotation)); + return classDeclarationKind; + } + + public visitCompilationUnit(compilationUnit: java.CompilationUnit, p: P): J | null { + compilationUnit = compilationUnit.withPrefix(this.visitSpace(compilationUnit.prefix, SpaceLocation.COMPILATION_UNIT_PREFIX, p)!); + compilationUnit = compilationUnit.withMarkers(this.visitMarkers(compilationUnit.markers, p)); + compilationUnit = compilationUnit.padding.withPackageDeclaration(this.visitRightPadded(compilationUnit.padding.packageDeclaration, JRightPaddedLocation.PACKAGE, p)); + compilationUnit = compilationUnit.padding.withImports(ListUtils.map(compilationUnit.padding.imports, el => this.visitRightPadded(el, JRightPaddedLocation.IMPORT, p))); + compilationUnit = compilationUnit.withClasses(ListUtils.map(compilationUnit.classes, el => this.visit(el, p) as java.ClassDeclaration)); + compilationUnit = compilationUnit.withEof(this.visitSpace(compilationUnit.eof, SpaceLocation.COMPILATION_UNIT_EOF, p)!); + return compilationUnit; + } + + public visitContinue(_continue: java.Continue, p: P): J | null { + _continue = _continue.withPrefix(this.visitSpace(_continue.prefix, SpaceLocation.CONTINUE_PREFIX, p)!); + let tempStatement = this.visitStatement(_continue, p) as Statement; + if (!(tempStatement instanceof java.Continue)) + { + return tempStatement; + } + _continue = tempStatement as java.Continue; + _continue = _continue.withMarkers(this.visitMarkers(_continue.markers, p)); + _continue = _continue.withLabel(this.visitAndCast(_continue.label, p)); + return _continue; + } + + public visitDoWhileLoop(doWhileLoop: java.DoWhileLoop, p: P): J | null { + doWhileLoop = doWhileLoop.withPrefix(this.visitSpace(doWhileLoop.prefix, SpaceLocation.DO_WHILE_PREFIX, p)!); + let tempStatement = this.visitStatement(doWhileLoop, p) as Statement; + if (!(tempStatement instanceof java.DoWhileLoop)) + { + return tempStatement; + } + doWhileLoop = tempStatement as java.DoWhileLoop; + doWhileLoop = doWhileLoop.withMarkers(this.visitMarkers(doWhileLoop.markers, p)); + doWhileLoop = doWhileLoop.padding.withBody(this.visitRightPadded(doWhileLoop.padding.body, JRightPaddedLocation.WHILE_BODY, p)!); + doWhileLoop = doWhileLoop.padding.withWhileCondition(this.visitLeftPadded(doWhileLoop.padding.whileCondition, JLeftPaddedLocation.WHILE_CONDITION, p)!); + return doWhileLoop; + } + + public visitEmpty(empty: java.Empty, p: P): J | null { + empty = empty.withPrefix(this.visitSpace(empty.prefix, SpaceLocation.EMPTY_PREFIX, p)!); + let tempStatement = this.visitStatement(empty, p) as Statement; + if (!(tempStatement instanceof java.Empty)) + { + return tempStatement; + } + empty = tempStatement as java.Empty; + let tempExpression = this.visitExpression(empty, p) as Expression; + if (!(tempExpression instanceof java.Empty)) + { + return tempExpression; + } + empty = tempExpression as java.Empty; + empty = empty.withMarkers(this.visitMarkers(empty.markers, p)); + return empty; + } + + public visitEnumValue(enumValue: java.EnumValue, p: P): J | null { + enumValue = enumValue.withPrefix(this.visitSpace(enumValue.prefix, SpaceLocation.ENUM_VALUE_PREFIX, p)!); + enumValue = enumValue.withMarkers(this.visitMarkers(enumValue.markers, p)); + enumValue = enumValue.withAnnotations(ListUtils.map(enumValue.annotations, el => this.visit(el, p) as java.Annotation)); + enumValue = enumValue.withName(this.visitAndCast(enumValue.name, p)!); + enumValue = enumValue.withInitializer(this.visitAndCast(enumValue.initializer, p)); + return enumValue; + } + + public visitEnumValueSet(enumValueSet: java.EnumValueSet, p: P): J | null { + enumValueSet = enumValueSet.withPrefix(this.visitSpace(enumValueSet.prefix, SpaceLocation.ENUM_VALUE_SET_PREFIX, p)!); + let tempStatement = this.visitStatement(enumValueSet, p) as Statement; + if (!(tempStatement instanceof java.EnumValueSet)) + { + return tempStatement; + } + enumValueSet = tempStatement as java.EnumValueSet; + enumValueSet = enumValueSet.withMarkers(this.visitMarkers(enumValueSet.markers, p)); + enumValueSet = enumValueSet.padding.withEnums(ListUtils.map(enumValueSet.padding.enums, el => this.visitRightPadded(el, JRightPaddedLocation.ENUM_VALUE, p))); + return enumValueSet; + } + + public visitFieldAccess(fieldAccess: java.FieldAccess, p: P): J | null { + fieldAccess = fieldAccess.withPrefix(this.visitSpace(fieldAccess.prefix, SpaceLocation.FIELD_ACCESS_PREFIX, p)!); + let tempStatement = this.visitStatement(fieldAccess, p) as Statement; + if (!(tempStatement instanceof java.FieldAccess)) + { + return tempStatement; + } + fieldAccess = tempStatement as java.FieldAccess; + let tempExpression = this.visitExpression(fieldAccess, p) as Expression; + if (!(tempExpression instanceof java.FieldAccess)) + { + return tempExpression; + } + fieldAccess = tempExpression as java.FieldAccess; + fieldAccess = fieldAccess.withMarkers(this.visitMarkers(fieldAccess.markers, p)); + fieldAccess = fieldAccess.withTarget(this.visitAndCast(fieldAccess.target, p)!); + fieldAccess = fieldAccess.padding.withName(this.visitLeftPadded(fieldAccess.padding.name, JLeftPaddedLocation.FIELD_ACCESS_NAME, p)!); + return fieldAccess; + } + + public visitForEachLoop(forEachLoop: java.ForEachLoop, p: P): J | null { + forEachLoop = forEachLoop.withPrefix(this.visitSpace(forEachLoop.prefix, SpaceLocation.FOR_EACH_LOOP_PREFIX, p)!); + let tempStatement = this.visitStatement(forEachLoop, p) as Statement; + if (!(tempStatement instanceof java.ForEachLoop)) + { + return tempStatement; + } + forEachLoop = tempStatement as java.ForEachLoop; + forEachLoop = forEachLoop.withMarkers(this.visitMarkers(forEachLoop.markers, p)); + forEachLoop = forEachLoop.withControl(this.visitAndCast(forEachLoop.control, p)!); + forEachLoop = forEachLoop.padding.withBody(this.visitRightPadded(forEachLoop.padding.body, JRightPaddedLocation.FOR_BODY, p)!); + return forEachLoop; + } + + public visitForEachControl(forEachLoopControl: java.ForEachLoopControl, p: P): J | null { + forEachLoopControl = forEachLoopControl.withPrefix(this.visitSpace(forEachLoopControl.prefix, SpaceLocation.FOR_EACH_CONTROL_PREFIX, p)!); + forEachLoopControl = forEachLoopControl.withMarkers(this.visitMarkers(forEachLoopControl.markers, p)); + forEachLoopControl = forEachLoopControl.padding.withVariable(this.visitRightPadded(forEachLoopControl.padding.variable, JRightPaddedLocation.FOREACH_VARIABLE, p)!); + forEachLoopControl = forEachLoopControl.padding.withIterable(this.visitRightPadded(forEachLoopControl.padding.iterable, JRightPaddedLocation.FOREACH_ITERABLE, p)!); + return forEachLoopControl; + } + + public visitForLoop(forLoop: java.ForLoop, p: P): J | null { + forLoop = forLoop.withPrefix(this.visitSpace(forLoop.prefix, SpaceLocation.FOR_PREFIX, p)!); + let tempStatement = this.visitStatement(forLoop, p) as Statement; + if (!(tempStatement instanceof java.ForLoop)) + { + return tempStatement; + } + forLoop = tempStatement as java.ForLoop; + forLoop = forLoop.withMarkers(this.visitMarkers(forLoop.markers, p)); + forLoop = forLoop.withControl(this.visitAndCast(forLoop.control, p)!); + forLoop = forLoop.padding.withBody(this.visitRightPadded(forLoop.padding.body, JRightPaddedLocation.FOR_BODY, p)!); + return forLoop; + } + + public visitForControl(forLoopControl: java.ForLoopControl, p: P): J | null { + forLoopControl = forLoopControl.withPrefix(this.visitSpace(forLoopControl.prefix, SpaceLocation.FOR_CONTROL_PREFIX, p)!); + forLoopControl = forLoopControl.withMarkers(this.visitMarkers(forLoopControl.markers, p)); + forLoopControl = forLoopControl.padding.withInit(ListUtils.map(forLoopControl.padding.init, el => this.visitRightPadded(el, JRightPaddedLocation.FOR_INIT, p))); + forLoopControl = forLoopControl.padding.withCondition(this.visitRightPadded(forLoopControl.padding.condition, JRightPaddedLocation.FOR_CONDITION, p)!); + forLoopControl = forLoopControl.padding.withUpdate(ListUtils.map(forLoopControl.padding.update, el => this.visitRightPadded(el, JRightPaddedLocation.FOR_UPDATE, p))); + return forLoopControl; + } + + public visitParenthesizedTypeTree(parenthesizedTypeTree: java.ParenthesizedTypeTree, p: P): J | null { + parenthesizedTypeTree = parenthesizedTypeTree.withPrefix(this.visitSpace(parenthesizedTypeTree.prefix, SpaceLocation.PARENTHESES_PREFIX, p)!); + let tempExpression = this.visitExpression(parenthesizedTypeTree, p) as Expression; + if (!(tempExpression instanceof java.ParenthesizedTypeTree)) + { + return tempExpression; + } + parenthesizedTypeTree = tempExpression as java.ParenthesizedTypeTree; + parenthesizedTypeTree = parenthesizedTypeTree.withMarkers(this.visitMarkers(parenthesizedTypeTree.markers, p)); + parenthesizedTypeTree = parenthesizedTypeTree.withAnnotations(ListUtils.map(parenthesizedTypeTree.annotations, el => this.visit(el, p) as java.Annotation)); + parenthesizedTypeTree = parenthesizedTypeTree.withParenthesizedType(this.visitAndCast(parenthesizedTypeTree.parenthesizedType, p)!); + return parenthesizedTypeTree; + } + + public visitIdentifier(identifier: java.Identifier, p: P): J | null { + identifier = identifier.withPrefix(this.visitSpace(identifier.prefix, SpaceLocation.IDENTIFIER_PREFIX, p)!); + let tempExpression = this.visitExpression(identifier, p) as Expression; + if (!(tempExpression instanceof java.Identifier)) + { + return tempExpression; + } + identifier = tempExpression as java.Identifier; + identifier = identifier.withMarkers(this.visitMarkers(identifier.markers, p)); + identifier = identifier.withAnnotations(ListUtils.map(identifier.annotations, el => this.visit(el, p) as java.Annotation)); + return identifier; + } + + public visitIf(_if: java.If, p: P): J | null { + _if = _if.withPrefix(this.visitSpace(_if.prefix, SpaceLocation.IF_PREFIX, p)!); + let tempStatement = this.visitStatement(_if, p) as Statement; + if (!(tempStatement instanceof java.If)) + { + return tempStatement; + } + _if = tempStatement as java.If; + _if = _if.withMarkers(this.visitMarkers(_if.markers, p)); + _if = _if.withIfCondition(this.visitAndCast(_if.ifCondition, p)!); + _if = _if.padding.withThenPart(this.visitRightPadded(_if.padding.thenPart, JRightPaddedLocation.IF_THEN, p)!); + _if = _if.withElsePart(this.visitAndCast(_if.elsePart, p)); + return _if; + } + + public visitElse(ifElse: java.IfElse, p: P): J | null { + ifElse = ifElse.withPrefix(this.visitSpace(ifElse.prefix, SpaceLocation.ELSE_PREFIX, p)!); + ifElse = ifElse.withMarkers(this.visitMarkers(ifElse.markers, p)); + ifElse = ifElse.padding.withBody(this.visitRightPadded(ifElse.padding.body, JRightPaddedLocation.IF_ELSE, p)!); + return ifElse; + } + + public visitImport(_import: java.Import, p: P): J | null { + _import = _import.withPrefix(this.visitSpace(_import.prefix, SpaceLocation.IMPORT_PREFIX, p)!); + let tempStatement = this.visitStatement(_import, p) as Statement; + if (!(tempStatement instanceof java.Import)) + { + return tempStatement; + } + _import = tempStatement as java.Import; + _import = _import.withMarkers(this.visitMarkers(_import.markers, p)); + _import = _import.padding.withStatic(this.visitLeftPadded(_import.padding.static, JLeftPaddedLocation.STATIC_IMPORT, p)!); + _import = _import.withQualid(this.visitAndCast(_import.qualid, p)!); + _import = _import.padding.withAlias(this.visitLeftPadded(_import.padding.alias, JLeftPaddedLocation.IMPORT_ALIAS_PREFIX, p)); + return _import; + } + + public visitInstanceOf(instanceOf: java.InstanceOf, p: P): J | null { + instanceOf = instanceOf.withPrefix(this.visitSpace(instanceOf.prefix, SpaceLocation.INSTANCEOF_PREFIX, p)!); + let tempExpression = this.visitExpression(instanceOf, p) as Expression; + if (!(tempExpression instanceof java.InstanceOf)) + { + return tempExpression; + } + instanceOf = tempExpression as java.InstanceOf; + instanceOf = instanceOf.withMarkers(this.visitMarkers(instanceOf.markers, p)); + instanceOf = instanceOf.padding.withExpression(this.visitRightPadded(instanceOf.padding.expression, JRightPaddedLocation.INSTANCEOF, p)!); + instanceOf = instanceOf.withClazz(this.visitAndCast(instanceOf.clazz, p)!); + instanceOf = instanceOf.withPattern(this.visitAndCast(instanceOf.pattern, p)); + return instanceOf; + } + + public visitIntersectionType(intersectionType: java.IntersectionType, p: P): J | null { + intersectionType = intersectionType.withPrefix(this.visitSpace(intersectionType.prefix, SpaceLocation.INTERSECTION_TYPE_PREFIX, p)!); + let tempExpression = this.visitExpression(intersectionType, p) as Expression; + if (!(tempExpression instanceof java.IntersectionType)) + { + return tempExpression; + } + intersectionType = tempExpression as java.IntersectionType; + intersectionType = intersectionType.withMarkers(this.visitMarkers(intersectionType.markers, p)); + intersectionType = intersectionType.padding.withBounds(this.visitContainer(intersectionType.padding.bounds, JContainerLocation.TYPE_BOUNDS, p)!); + return intersectionType; + } + + public visitLabel(label: java.Label, p: P): J | null { + label = label.withPrefix(this.visitSpace(label.prefix, SpaceLocation.LABEL_PREFIX, p)!); + let tempStatement = this.visitStatement(label, p) as Statement; + if (!(tempStatement instanceof java.Label)) + { + return tempStatement; + } + label = tempStatement as java.Label; + label = label.withMarkers(this.visitMarkers(label.markers, p)); + label = label.padding.withLabel(this.visitRightPadded(label.padding.label, JRightPaddedLocation.LABEL, p)!); + label = label.withStatement(this.visitAndCast(label.statement, p)!); + return label; + } + + public visitLambda(lambda: java.Lambda, p: P): J | null { + lambda = lambda.withPrefix(this.visitSpace(lambda.prefix, SpaceLocation.LAMBDA_PREFIX, p)!); + let tempStatement = this.visitStatement(lambda, p) as Statement; + if (!(tempStatement instanceof java.Lambda)) + { + return tempStatement; + } + lambda = tempStatement as java.Lambda; + let tempExpression = this.visitExpression(lambda, p) as Expression; + if (!(tempExpression instanceof java.Lambda)) + { + return tempExpression; + } + lambda = tempExpression as java.Lambda; + lambda = lambda.withMarkers(this.visitMarkers(lambda.markers, p)); + lambda = lambda.withParameters(this.visitAndCast(lambda.parameters, p)!); + lambda = lambda.withArrow(this.visitSpace(lambda.arrow, SpaceLocation.LAMBDA_ARROW_PREFIX, p)!); + lambda = lambda.withBody(this.visitAndCast(lambda.body, p)!); + return lambda; + } + + public visitLambdaParameters(lambdaParameters: java.LambdaParameters, p: P): J | null { + lambdaParameters = lambdaParameters.withPrefix(this.visitSpace(lambdaParameters.prefix, SpaceLocation.LAMBDA_PARAMETERS_PREFIX, p)!); + lambdaParameters = lambdaParameters.withMarkers(this.visitMarkers(lambdaParameters.markers, p)); + lambdaParameters = lambdaParameters.padding.withParameters(ListUtils.map(lambdaParameters.padding.parameters, el => this.visitRightPadded(el, JRightPaddedLocation.LAMBDA_PARAM, p))); + return lambdaParameters; + } + + public visitLiteral(literal: java.Literal, p: P): J | null { + literal = literal.withPrefix(this.visitSpace(literal.prefix, SpaceLocation.LITERAL_PREFIX, p)!); + let tempExpression = this.visitExpression(literal, p) as Expression; + if (!(tempExpression instanceof java.Literal)) + { + return tempExpression; + } + literal = tempExpression as java.Literal; + literal = literal.withMarkers(this.visitMarkers(literal.markers, p)); + return literal; + } + + public visitMemberReference(memberReference: java.MemberReference, p: P): J | null { + memberReference = memberReference.withPrefix(this.visitSpace(memberReference.prefix, SpaceLocation.MEMBER_REFERENCE_PREFIX, p)!); + let tempExpression = this.visitExpression(memberReference, p) as Expression; + if (!(tempExpression instanceof java.MemberReference)) + { + return tempExpression; + } + memberReference = tempExpression as java.MemberReference; + memberReference = memberReference.withMarkers(this.visitMarkers(memberReference.markers, p)); + memberReference = memberReference.padding.withContaining(this.visitRightPadded(memberReference.padding.containing, JRightPaddedLocation.MEMBER_REFERENCE_CONTAINING, p)!); + memberReference = memberReference.padding.withTypeParameters(this.visitContainer(memberReference.padding.typeParameters, JContainerLocation.TYPE_PARAMETERS, p)); + memberReference = memberReference.padding.withReference(this.visitLeftPadded(memberReference.padding.reference, JLeftPaddedLocation.MEMBER_REFERENCE_NAME, p)!); + return memberReference; + } + + public visitMethodDeclaration(methodDeclaration: java.MethodDeclaration, p: P): J | null { + methodDeclaration = methodDeclaration.withPrefix(this.visitSpace(methodDeclaration.prefix, SpaceLocation.METHOD_DECLARATION_PREFIX, p)!); + let tempStatement = this.visitStatement(methodDeclaration, p) as Statement; + if (!(tempStatement instanceof java.MethodDeclaration)) + { + return tempStatement; + } + methodDeclaration = tempStatement as java.MethodDeclaration; + methodDeclaration = methodDeclaration.withMarkers(this.visitMarkers(methodDeclaration.markers, p)); + methodDeclaration = methodDeclaration.withLeadingAnnotations(ListUtils.map(methodDeclaration.leadingAnnotations, el => this.visit(el, p) as java.Annotation)); + methodDeclaration = methodDeclaration.withModifiers(ListUtils.map(methodDeclaration.modifiers, el => this.visit(el, p) as java.Modifier)); + methodDeclaration = methodDeclaration.annotations.withTypeParameters(this.visitAndCast(methodDeclaration.annotations.typeParameters, p)); + methodDeclaration = methodDeclaration.withReturnTypeExpression(this.visitAndCast(methodDeclaration.returnTypeExpression, p)); + methodDeclaration = methodDeclaration.annotations.withName(methodDeclaration.annotations.name.withAnnotations(ListUtils.map(methodDeclaration.annotations.name.annotations, el => this.visit(el, p) as java.Annotation)).withIdentifier(this.visitAndCast(methodDeclaration.annotations.name.identifier, p)!)); + methodDeclaration = methodDeclaration.padding.withParameters(this.visitContainer(methodDeclaration.padding.parameters, JContainerLocation.METHOD_DECLARATION_PARAMETERS, p)!); + methodDeclaration = methodDeclaration.padding.withThrows(this.visitContainer(methodDeclaration.padding.throws, JContainerLocation.THROWS, p)); + methodDeclaration = methodDeclaration.withBody(this.visitAndCast(methodDeclaration.body, p)); + methodDeclaration = methodDeclaration.padding.withDefaultValue(this.visitLeftPadded(methodDeclaration.padding.defaultValue, JLeftPaddedLocation.METHOD_DECLARATION_DEFAULT_VALUE, p)); + return methodDeclaration; + } + + public visitMethodInvocation(methodInvocation: java.MethodInvocation, p: P): J | null { + methodInvocation = methodInvocation.withPrefix(this.visitSpace(methodInvocation.prefix, SpaceLocation.METHOD_INVOCATION_PREFIX, p)!); + let tempStatement = this.visitStatement(methodInvocation, p) as Statement; + if (!(tempStatement instanceof java.MethodInvocation)) + { + return tempStatement; + } + methodInvocation = tempStatement as java.MethodInvocation; + let tempExpression = this.visitExpression(methodInvocation, p) as Expression; + if (!(tempExpression instanceof java.MethodInvocation)) + { + return tempExpression; + } + methodInvocation = tempExpression as java.MethodInvocation; + methodInvocation = methodInvocation.withMarkers(this.visitMarkers(methodInvocation.markers, p)); + methodInvocation = methodInvocation.padding.withSelect(this.visitRightPadded(methodInvocation.padding.select, JRightPaddedLocation.METHOD_SELECT, p)); + methodInvocation = methodInvocation.padding.withTypeParameters(this.visitContainer(methodInvocation.padding.typeParameters, JContainerLocation.TYPE_PARAMETERS, p)); + methodInvocation = methodInvocation.withName(this.visitAndCast(methodInvocation.name, p)!); + methodInvocation = methodInvocation.padding.withArguments(this.visitContainer(methodInvocation.padding.arguments, JContainerLocation.METHOD_INVOCATION_ARGUMENTS, p)!); + return methodInvocation; + } + + public visitModifier(modifier: java.Modifier, p: P): J | null { + modifier = modifier.withPrefix(this.visitSpace(modifier.prefix, SpaceLocation.MODIFIER_PREFIX, p)!); + modifier = modifier.withMarkers(this.visitMarkers(modifier.markers, p)); + modifier = modifier.withAnnotations(ListUtils.map(modifier.annotations, el => this.visit(el, p) as java.Annotation)); + return modifier; + } + + public visitMultiCatch(multiCatch: java.MultiCatch, p: P): J | null { + multiCatch = multiCatch.withPrefix(this.visitSpace(multiCatch.prefix, SpaceLocation.MULTI_CATCH_PREFIX, p)!); + multiCatch = multiCatch.withMarkers(this.visitMarkers(multiCatch.markers, p)); + multiCatch = multiCatch.padding.withAlternatives(ListUtils.map(multiCatch.padding.alternatives, el => this.visitRightPadded(el, JRightPaddedLocation.CATCH_ALTERNATIVE, p))); + return multiCatch; + } + + public visitNewArray(newArray: java.NewArray, p: P): J | null { + newArray = newArray.withPrefix(this.visitSpace(newArray.prefix, SpaceLocation.NEW_ARRAY_PREFIX, p)!); + let tempExpression = this.visitExpression(newArray, p) as Expression; + if (!(tempExpression instanceof java.NewArray)) + { + return tempExpression; + } + newArray = tempExpression as java.NewArray; + newArray = newArray.withMarkers(this.visitMarkers(newArray.markers, p)); + newArray = newArray.withTypeExpression(this.visitAndCast(newArray.typeExpression, p)); + newArray = newArray.withDimensions(ListUtils.map(newArray.dimensions, el => this.visit(el, p) as java.ArrayDimension)); + newArray = newArray.padding.withInitializer(this.visitContainer(newArray.padding.initializer, JContainerLocation.NEW_ARRAY_INITIALIZER, p)); + return newArray; + } + + public visitArrayDimension(arrayDimension: java.ArrayDimension, p: P): J | null { + arrayDimension = arrayDimension.withPrefix(this.visitSpace(arrayDimension.prefix, SpaceLocation.DIMENSION_PREFIX, p)!); + arrayDimension = arrayDimension.withMarkers(this.visitMarkers(arrayDimension.markers, p)); + arrayDimension = arrayDimension.padding.withIndex(this.visitRightPadded(arrayDimension.padding.index, JRightPaddedLocation.ARRAY_INDEX, p)!); + return arrayDimension; + } + + public visitNewClass(newClass: java.NewClass, p: P): J | null { + newClass = newClass.withPrefix(this.visitSpace(newClass.prefix, SpaceLocation.NEW_CLASS_PREFIX, p)!); + let tempStatement = this.visitStatement(newClass, p) as Statement; + if (!(tempStatement instanceof java.NewClass)) + { + return tempStatement; + } + newClass = tempStatement as java.NewClass; + let tempExpression = this.visitExpression(newClass, p) as Expression; + if (!(tempExpression instanceof java.NewClass)) + { + return tempExpression; + } + newClass = tempExpression as java.NewClass; + newClass = newClass.withMarkers(this.visitMarkers(newClass.markers, p)); + newClass = newClass.padding.withEnclosing(this.visitRightPadded(newClass.padding.enclosing, JRightPaddedLocation.NEW_CLASS_ENCLOSING, p)); + newClass = newClass.withNew(this.visitSpace(newClass.new, SpaceLocation.NEW_PREFIX, p)!); + newClass = newClass.withClazz(this.visitAndCast(newClass.clazz, p)); + newClass = newClass.padding.withArguments(this.visitContainer(newClass.padding.arguments, JContainerLocation.NEW_CLASS_ARGUMENTS, p)!); + newClass = newClass.withBody(this.visitAndCast(newClass.body, p)); + return newClass; + } + + public visitNullableType(nullableType: java.NullableType, p: P): J | null { + nullableType = nullableType.withPrefix(this.visitSpace(nullableType.prefix, SpaceLocation.NULLABLE_TYPE_PREFIX, p)!); + let tempExpression = this.visitExpression(nullableType, p) as Expression; + if (!(tempExpression instanceof java.NullableType)) + { + return tempExpression; + } + nullableType = tempExpression as java.NullableType; + nullableType = nullableType.withMarkers(this.visitMarkers(nullableType.markers, p)); + nullableType = nullableType.withAnnotations(ListUtils.map(nullableType.annotations, el => this.visit(el, p) as java.Annotation)); + nullableType = nullableType.padding.withTypeTree(this.visitRightPadded(nullableType.padding.typeTree, JRightPaddedLocation.NULLABLE, p)!); + return nullableType; + } + + public visitPackage(_package: java.Package, p: P): J | null { + _package = _package.withPrefix(this.visitSpace(_package.prefix, SpaceLocation.PACKAGE_PREFIX, p)!); + let tempStatement = this.visitStatement(_package, p) as Statement; + if (!(tempStatement instanceof java.Package)) + { + return tempStatement; + } + _package = tempStatement as java.Package; + _package = _package.withMarkers(this.visitMarkers(_package.markers, p)); + _package = _package.withExpression(this.visitAndCast(_package.expression, p)!); + _package = _package.withAnnotations(ListUtils.map(_package.annotations, el => this.visit(el, p) as java.Annotation)); + return _package; + } + + public visitParameterizedType(parameterizedType: java.ParameterizedType, p: P): J | null { + parameterizedType = parameterizedType.withPrefix(this.visitSpace(parameterizedType.prefix, SpaceLocation.PARAMETERIZED_TYPE_PREFIX, p)!); + let tempExpression = this.visitExpression(parameterizedType, p) as Expression; + if (!(tempExpression instanceof java.ParameterizedType)) + { + return tempExpression; + } + parameterizedType = tempExpression as java.ParameterizedType; + parameterizedType = parameterizedType.withMarkers(this.visitMarkers(parameterizedType.markers, p)); + parameterizedType = parameterizedType.withClazz(this.visitAndCast(parameterizedType.clazz, p)!); + parameterizedType = parameterizedType.padding.withTypeParameters(this.visitContainer(parameterizedType.padding.typeParameters, JContainerLocation.TYPE_PARAMETERS, p)); + return parameterizedType; + } + + public visitParentheses(parentheses: java.Parentheses, p: P): J | null { + parentheses = parentheses.withPrefix(this.visitSpace(parentheses.prefix, SpaceLocation.PARENTHESES_PREFIX, p)!); + let tempExpression = this.visitExpression(parentheses, p) as Expression; + if (!(tempExpression instanceof java.Parentheses)) + { + return tempExpression; + } + parentheses = tempExpression as java.Parentheses; + parentheses = parentheses.withMarkers(this.visitMarkers(parentheses.markers, p)); + parentheses = parentheses.padding.withTree(this.visitRightPadded(parentheses.padding.tree, JRightPaddedLocation.PARENTHESES, p)!); + return parentheses; + } + + public visitControlParentheses(controlParentheses: java.ControlParentheses, p: P): J | null { + controlParentheses = controlParentheses.withPrefix(this.visitSpace(controlParentheses.prefix, SpaceLocation.CONTROL_PARENTHESES_PREFIX, p)!); + let tempExpression = this.visitExpression(controlParentheses, p) as Expression; + if (!(tempExpression instanceof java.ControlParentheses)) + { + return tempExpression; + } + controlParentheses = tempExpression as java.ControlParentheses; + controlParentheses = controlParentheses.withMarkers(this.visitMarkers(controlParentheses.markers, p)); + controlParentheses = controlParentheses.padding.withTree(this.visitRightPadded(controlParentheses.padding.tree, JRightPaddedLocation.PARENTHESES, p)!); + return controlParentheses; + } + + public visitPrimitive(primitive: java.Primitive, p: P): J | null { + primitive = primitive.withPrefix(this.visitSpace(primitive.prefix, SpaceLocation.PRIMITIVE_PREFIX, p)!); + let tempExpression = this.visitExpression(primitive, p) as Expression; + if (!(tempExpression instanceof java.Primitive)) + { + return tempExpression; + } + primitive = tempExpression as java.Primitive; + primitive = primitive.withMarkers(this.visitMarkers(primitive.markers, p)); + return primitive; + } + + public visitReturn(_return: java.Return, p: P): J | null { + _return = _return.withPrefix(this.visitSpace(_return.prefix, SpaceLocation.RETURN_PREFIX, p)!); + let tempStatement = this.visitStatement(_return, p) as Statement; + if (!(tempStatement instanceof java.Return)) + { + return tempStatement; + } + _return = tempStatement as java.Return; + _return = _return.withMarkers(this.visitMarkers(_return.markers, p)); + _return = _return.withExpression(this.visitAndCast(_return.expression, p)); + return _return; + } + + public visitSwitch(_switch: java.Switch, p: P): J | null { + _switch = _switch.withPrefix(this.visitSpace(_switch.prefix, SpaceLocation.SWITCH_PREFIX, p)!); + let tempStatement = this.visitStatement(_switch, p) as Statement; + if (!(tempStatement instanceof java.Switch)) + { + return tempStatement; + } + _switch = tempStatement as java.Switch; + _switch = _switch.withMarkers(this.visitMarkers(_switch.markers, p)); + _switch = _switch.withSelector(this.visitAndCast(_switch.selector, p)!); + _switch = _switch.withCases(this.visitAndCast(_switch.cases, p)!); + return _switch; + } + + public visitSwitchExpression(switchExpression: java.SwitchExpression, p: P): J | null { + switchExpression = switchExpression.withPrefix(this.visitSpace(switchExpression.prefix, SpaceLocation.SWITCH_EXPRESSION_PREFIX, p)!); + let tempExpression = this.visitExpression(switchExpression, p) as Expression; + if (!(tempExpression instanceof java.SwitchExpression)) + { + return tempExpression; + } + switchExpression = tempExpression as java.SwitchExpression; + switchExpression = switchExpression.withMarkers(this.visitMarkers(switchExpression.markers, p)); + switchExpression = switchExpression.withSelector(this.visitAndCast(switchExpression.selector, p)!); + switchExpression = switchExpression.withCases(this.visitAndCast(switchExpression.cases, p)!); + return switchExpression; + } + + public visitSynchronized(synchronized: java.Synchronized, p: P): J | null { + synchronized = synchronized.withPrefix(this.visitSpace(synchronized.prefix, SpaceLocation.SYNCHRONIZED_PREFIX, p)!); + let tempStatement = this.visitStatement(synchronized, p) as Statement; + if (!(tempStatement instanceof java.Synchronized)) + { + return tempStatement; + } + synchronized = tempStatement as java.Synchronized; + synchronized = synchronized.withMarkers(this.visitMarkers(synchronized.markers, p)); + synchronized = synchronized.withLock(this.visitAndCast(synchronized.lock, p)!); + synchronized = synchronized.withBody(this.visitAndCast(synchronized.body, p)!); + return synchronized; + } + + public visitTernary(ternary: java.Ternary, p: P): J | null { + ternary = ternary.withPrefix(this.visitSpace(ternary.prefix, SpaceLocation.TERNARY_PREFIX, p)!); + let tempStatement = this.visitStatement(ternary, p) as Statement; + if (!(tempStatement instanceof java.Ternary)) + { + return tempStatement; + } + ternary = tempStatement as java.Ternary; + let tempExpression = this.visitExpression(ternary, p) as Expression; + if (!(tempExpression instanceof java.Ternary)) + { + return tempExpression; + } + ternary = tempExpression as java.Ternary; + ternary = ternary.withMarkers(this.visitMarkers(ternary.markers, p)); + ternary = ternary.withCondition(this.visitAndCast(ternary.condition, p)!); + ternary = ternary.padding.withTruePart(this.visitLeftPadded(ternary.padding.truePart, JLeftPaddedLocation.TERNARY_TRUE, p)!); + ternary = ternary.padding.withFalsePart(this.visitLeftPadded(ternary.padding.falsePart, JLeftPaddedLocation.TERNARY_FALSE, p)!); + return ternary; + } + + public visitThrow(_throw: java.Throw, p: P): J | null { + _throw = _throw.withPrefix(this.visitSpace(_throw.prefix, SpaceLocation.THROW_PREFIX, p)!); + let tempStatement = this.visitStatement(_throw, p) as Statement; + if (!(tempStatement instanceof java.Throw)) + { + return tempStatement; + } + _throw = tempStatement as java.Throw; + _throw = _throw.withMarkers(this.visitMarkers(_throw.markers, p)); + _throw = _throw.withException(this.visitAndCast(_throw.exception, p)!); + return _throw; + } + + public visitTry(_try: java.Try, p: P): J | null { + _try = _try.withPrefix(this.visitSpace(_try.prefix, SpaceLocation.TRY_PREFIX, p)!); + let tempStatement = this.visitStatement(_try, p) as Statement; + if (!(tempStatement instanceof java.Try)) + { + return tempStatement; + } + _try = tempStatement as java.Try; + _try = _try.withMarkers(this.visitMarkers(_try.markers, p)); + _try = _try.padding.withResources(this.visitContainer(_try.padding.resources, JContainerLocation.TRY_RESOURCES, p)); + _try = _try.withBody(this.visitAndCast(_try.body, p)!); + _try = _try.withCatches(ListUtils.map(_try.catches, el => this.visit(el, p) as java.TryCatch)); + _try = _try.padding.withFinally(this.visitLeftPadded(_try.padding.finally, JLeftPaddedLocation.TRY_FINALLY, p)); + return _try; + } + + public visitTryResource(tryResource: java.TryResource, p: P): J | null { + tryResource = tryResource.withPrefix(this.visitSpace(tryResource.prefix, SpaceLocation.TRY_RESOURCE, p)!); + tryResource = tryResource.withMarkers(this.visitMarkers(tryResource.markers, p)); + tryResource = tryResource.withVariableDeclarations(this.visitAndCast(tryResource.variableDeclarations, p)!); + return tryResource; + } + + public visitCatch(tryCatch: java.TryCatch, p: P): J | null { + tryCatch = tryCatch.withPrefix(this.visitSpace(tryCatch.prefix, SpaceLocation.CATCH_PREFIX, p)!); + tryCatch = tryCatch.withMarkers(this.visitMarkers(tryCatch.markers, p)); + tryCatch = tryCatch.withParameter(this.visitAndCast(tryCatch.parameter, p)!); + tryCatch = tryCatch.withBody(this.visitAndCast(tryCatch.body, p)!); + return tryCatch; + } + + public visitTypeCast(typeCast: java.TypeCast, p: P): J | null { + typeCast = typeCast.withPrefix(this.visitSpace(typeCast.prefix, SpaceLocation.TYPE_CAST_PREFIX, p)!); + let tempExpression = this.visitExpression(typeCast, p) as Expression; + if (!(tempExpression instanceof java.TypeCast)) + { + return tempExpression; + } + typeCast = tempExpression as java.TypeCast; + typeCast = typeCast.withMarkers(this.visitMarkers(typeCast.markers, p)); + typeCast = typeCast.withClazz(this.visitAndCast(typeCast.clazz, p)!); + typeCast = typeCast.withExpression(this.visitAndCast(typeCast.expression, p)!); + return typeCast; + } + + public visitTypeParameter(typeParameter: java.TypeParameter, p: P): J | null { + typeParameter = typeParameter.withPrefix(this.visitSpace(typeParameter.prefix, SpaceLocation.TYPE_PARAMETERS_PREFIX, p)!); + typeParameter = typeParameter.withMarkers(this.visitMarkers(typeParameter.markers, p)); + typeParameter = typeParameter.withAnnotations(ListUtils.map(typeParameter.annotations, el => this.visit(el, p) as java.Annotation)); + typeParameter = typeParameter.withModifiers(ListUtils.map(typeParameter.modifiers, el => this.visit(el, p) as java.Modifier)); + typeParameter = typeParameter.withName(this.visitAndCast(typeParameter.name, p)!); + typeParameter = typeParameter.padding.withBounds(this.visitContainer(typeParameter.padding.bounds, JContainerLocation.TYPE_BOUNDS, p)); + return typeParameter; + } + + public visitTypeParameters(typeParameters: java.TypeParameters, p: P): J | null { + typeParameters = typeParameters.withPrefix(this.visitSpace(typeParameters.prefix, SpaceLocation.TYPE_PARAMETERS_PREFIX, p)!); + typeParameters = typeParameters.withMarkers(this.visitMarkers(typeParameters.markers, p)); + typeParameters = typeParameters.withAnnotations(ListUtils.map(typeParameters.annotations, el => this.visit(el, p) as java.Annotation)); + typeParameters = typeParameters.padding.withTypeParameters(ListUtils.map(typeParameters.padding.typeParameters, el => this.visitRightPadded(el, JRightPaddedLocation.TYPE_PARAMETER, p))); + return typeParameters; + } + + public visitUnary(unary: java.Unary, p: P): J | null { + unary = unary.withPrefix(this.visitSpace(unary.prefix, SpaceLocation.UNARY_PREFIX, p)!); + let tempStatement = this.visitStatement(unary, p) as Statement; + if (!(tempStatement instanceof java.Unary)) + { + return tempStatement; + } + unary = tempStatement as java.Unary; + let tempExpression = this.visitExpression(unary, p) as Expression; + if (!(tempExpression instanceof java.Unary)) + { + return tempExpression; + } + unary = tempExpression as java.Unary; + unary = unary.withMarkers(this.visitMarkers(unary.markers, p)); + unary = unary.padding.withOperator(this.visitLeftPadded(unary.padding.operator, JLeftPaddedLocation.UNARY_OPERATOR, p)!); + unary = unary.withExpression(this.visitAndCast(unary.expression, p)!); + return unary; + } + + public visitVariableDeclarations(variableDeclarations: java.VariableDeclarations, p: P): J | null { + variableDeclarations = variableDeclarations.withPrefix(this.visitSpace(variableDeclarations.prefix, SpaceLocation.VARIABLE_DECLARATIONS_PREFIX, p)!); + let tempStatement = this.visitStatement(variableDeclarations, p) as Statement; + if (!(tempStatement instanceof java.VariableDeclarations)) + { + return tempStatement; + } + variableDeclarations = tempStatement as java.VariableDeclarations; + variableDeclarations = variableDeclarations.withMarkers(this.visitMarkers(variableDeclarations.markers, p)); + variableDeclarations = variableDeclarations.withLeadingAnnotations(ListUtils.map(variableDeclarations.leadingAnnotations, el => this.visit(el, p) as java.Annotation)); + variableDeclarations = variableDeclarations.withModifiers(ListUtils.map(variableDeclarations.modifiers, el => this.visit(el, p) as java.Modifier)); + variableDeclarations = variableDeclarations.withTypeExpression(this.visitAndCast(variableDeclarations.typeExpression, p)); + variableDeclarations = variableDeclarations.withVarargs(this.visitSpace(variableDeclarations.varargs, SpaceLocation.VARARGS, p)); + variableDeclarations = variableDeclarations.withDimensionsBeforeName([el.with_before(self.visit_space(el.before, Space.Location.DIMENSION_PREFIX, p)).with_element(self.visit_space(el.element, Space.Location.DIMENSION, p)) for el in variable_declarations.dimensions_before_name]); + variableDeclarations = variableDeclarations.padding.withVariables(ListUtils.map(variableDeclarations.padding.variables, el => this.visitRightPadded(el, JRightPaddedLocation.NAMED_VARIABLE, p))); + return variableDeclarations; + } + + public visitVariable(variableDeclarationsNamedVariable: java.VariableDeclarationsNamedVariable, p: P): J | null { + variableDeclarationsNamedVariable = variableDeclarationsNamedVariable.withPrefix(this.visitSpace(variableDeclarationsNamedVariable.prefix, SpaceLocation.VARIABLE_PREFIX, p)!); + variableDeclarationsNamedVariable = variableDeclarationsNamedVariable.withMarkers(this.visitMarkers(variableDeclarationsNamedVariable.markers, p)); + variableDeclarationsNamedVariable = variableDeclarationsNamedVariable.withName(this.visitAndCast(variableDeclarationsNamedVariable.name, p)!); + variableDeclarationsNamedVariable = variableDeclarationsNamedVariable.withDimensionsAfterName([el.with_before(self.visit_space(el.before, Space.Location.DIMENSION_PREFIX, p)).with_element(self.visit_space(el.element, Space.Location.DIMENSION, p)) for el in named_variable.dimensions_after_name]); + variableDeclarationsNamedVariable = variableDeclarationsNamedVariable.padding.withInitializer(this.visitLeftPadded(variableDeclarationsNamedVariable.padding.initializer, JLeftPaddedLocation.VARIABLE_INITIALIZER, p)); + return variableDeclarationsNamedVariable; + } + + public visitWhileLoop(whileLoop: java.WhileLoop, p: P): J | null { + whileLoop = whileLoop.withPrefix(this.visitSpace(whileLoop.prefix, SpaceLocation.WHILE_PREFIX, p)!); + let tempStatement = this.visitStatement(whileLoop, p) as Statement; + if (!(tempStatement instanceof java.WhileLoop)) + { + return tempStatement; + } + whileLoop = tempStatement as java.WhileLoop; + whileLoop = whileLoop.withMarkers(this.visitMarkers(whileLoop.markers, p)); + whileLoop = whileLoop.withCondition(this.visitAndCast(whileLoop.condition, p)!); + whileLoop = whileLoop.padding.withBody(this.visitRightPadded(whileLoop.padding.body, JRightPaddedLocation.WHILE_BODY, p)!); + return whileLoop; + } + + public visitWildcard(wildcard: java.Wildcard, p: P): J | null { + wildcard = wildcard.withPrefix(this.visitSpace(wildcard.prefix, SpaceLocation.WILDCARD_PREFIX, p)!); + let tempExpression = this.visitExpression(wildcard, p) as Expression; + if (!(tempExpression instanceof java.Wildcard)) + { + return tempExpression; + } + wildcard = tempExpression as java.Wildcard; + wildcard = wildcard.withMarkers(this.visitMarkers(wildcard.markers, p)); + wildcard = wildcard.padding.withBound(this.visitLeftPadded(wildcard.padding.bound, JLeftPaddedLocation.WILDCARD_BOUND, p)); + wildcard = wildcard.withBoundedType(this.visitAndCast(wildcard.boundedType, p)); + return wildcard; + } + + public visitYield(_yield: java.Yield, p: P): J | null { + _yield = _yield.withPrefix(this.visitSpace(_yield.prefix, SpaceLocation.YIELD_PREFIX, p)!); + let tempStatement = this.visitStatement(_yield, p) as Statement; + if (!(tempStatement instanceof java.Yield)) + { + return tempStatement; + } + _yield = tempStatement as java.Yield; + _yield = _yield.withMarkers(this.visitMarkers(_yield.markers, p)); + _yield = _yield.withValue(this.visitAndCast(_yield.value, p)!); + return _yield; + } + + public visitUnknown(unknown: java.Unknown, p: P): J | null { + unknown = unknown.withPrefix(this.visitSpace(unknown.prefix, SpaceLocation.UNKNOWN_PREFIX, p)!); + let tempStatement = this.visitStatement(unknown, p) as Statement; + if (!(tempStatement instanceof java.Unknown)) + { + return tempStatement; + } + unknown = tempStatement as java.Unknown; + let tempExpression = this.visitExpression(unknown, p) as Expression; + if (!(tempExpression instanceof java.Unknown)) + { + return tempExpression; + } + unknown = tempExpression as java.Unknown; + unknown = unknown.withMarkers(this.visitMarkers(unknown.markers, p)); + unknown = unknown.withSource(this.visitAndCast(unknown.source, p)!); + return unknown; + } + + public visitUnknownSource(unknownSource: java.UnknownSource, p: P): J | null { + unknownSource = unknownSource.withPrefix(this.visitSpace(unknownSource.prefix, SpaceLocation.UNKNOWN_SOURCE_PREFIX, p)!); + unknownSource = unknownSource.withMarkers(this.visitMarkers(unknownSource.markers, p)); + return unknownSource; + } + + public visitContainer(container: JContainer | null, loc: JContainerLocation, p: P) { + return extensions.visitContainer(this, container, loc, p); + } + + public visitLeftPadded(left: JLeftPadded | null, loc: JLeftPaddedLocation, p: P) { + return extensions.visitLeftPadded(this, left, loc, p); + } + + public visitRightPadded(right: JRightPadded | null, loc: JRightPaddedLocation, p: P) { + return extensions.visitRightPadded(this, right, loc, p); + } + + public visitSpace(space: Space | null, loc: SpaceLocation, p: P): Space { + return extensions.visitSpace(this, space, loc, p); + } + +}