|  | 
|  | 1 | +/******************************************************************************* | 
|  | 2 | + * Copyright (c) 2024 Advantest Europe GmbH and others. | 
|  | 3 | + * This program and the accompanying materials are made | 
|  | 4 | + * available under the terms of the Eclipse Public License 2.0 | 
|  | 5 | + * which is available at https://www.eclipse.org/legal/epl-2.0/ | 
|  | 6 | + * | 
|  | 7 | + * SPDX-License-Identifier: EPL-2.0 | 
|  | 8 | + * | 
|  | 9 | + * Contributors: | 
|  | 10 | + * Dietrich Travkin (Solunar GmbH) - Initial implementation | 
|  | 11 | + *******************************************************************************/ | 
|  | 12 | +package org.eclipse.cdt.lsp.services.ast; | 
|  | 13 | + | 
|  | 14 | +import java.util.Arrays; | 
|  | 15 | + | 
|  | 16 | +import org.eclipse.cdt.lsp.services.ClangdLanguageServer; | 
|  | 17 | +import org.eclipse.lsp4j.Range; | 
|  | 18 | +import org.eclipse.lsp4j.jsonrpc.util.Preconditions; | 
|  | 19 | +import org.eclipse.lsp4j.jsonrpc.util.ToStringBuilder; | 
|  | 20 | +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; | 
|  | 21 | + | 
|  | 22 | +/** | 
|  | 23 | + * Return type for the <em>textDocument/ast</em> request. | 
|  | 24 | + * This class was generated by the <em>org.eclipse.lsp4j.generator</em> bundle | 
|  | 25 | + * using xtend (see {@link org.eclipse.lsp4j.generator.JsonRpcData JsonRpcData} and | 
|  | 26 | + * the <a href="https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/jsonrpc.md">documentation</a>). | 
|  | 27 | + * | 
|  | 28 | + * @see {@link ClangdLanguageServer#getAst(AstParams)} | 
|  | 29 | + */ | 
|  | 30 | +public class AstNode { | 
|  | 31 | + | 
|  | 32 | +	@NonNull | 
|  | 33 | +	private String role; | 
|  | 34 | + | 
|  | 35 | +	@NonNull | 
|  | 36 | +	private String kind; | 
|  | 37 | + | 
|  | 38 | +	private String detail; | 
|  | 39 | + | 
|  | 40 | +	private String arcana; | 
|  | 41 | + | 
|  | 42 | +	@NonNull | 
|  | 43 | +	private Range range; | 
|  | 44 | + | 
|  | 45 | +	private AstNode[] children; | 
|  | 46 | + | 
|  | 47 | +	public AstNode() { | 
|  | 48 | + | 
|  | 49 | +	} | 
|  | 50 | + | 
|  | 51 | +	@NonNull | 
|  | 52 | +	public String getRole() { | 
|  | 53 | +		return role; | 
|  | 54 | +	} | 
|  | 55 | + | 
|  | 56 | +	public void setRole(@NonNull final String role) { | 
|  | 57 | +		this.role = Preconditions.<String>checkNotNull(role, "role"); //$NON-NLS-1$ | 
|  | 58 | +	} | 
|  | 59 | + | 
|  | 60 | +	@NonNull | 
|  | 61 | +	public String getKind() { | 
|  | 62 | +		return this.kind; | 
|  | 63 | +	} | 
|  | 64 | + | 
|  | 65 | +	public void setKind(@NonNull final String kind) { | 
|  | 66 | +		this.kind = Preconditions.<String>checkNotNull(kind, "kind"); //$NON-NLS-1$ | 
|  | 67 | +	} | 
|  | 68 | + | 
|  | 69 | +	public String getDetail() { | 
|  | 70 | +		return detail; | 
|  | 71 | +	} | 
|  | 72 | + | 
|  | 73 | +	public void setDetail(final String detail) { | 
|  | 74 | +		this.detail = detail; | 
|  | 75 | +	} | 
|  | 76 | + | 
|  | 77 | +	public String getArcana() { | 
|  | 78 | +		return arcana; | 
|  | 79 | +	} | 
|  | 80 | + | 
|  | 81 | +	public void setArcana(final String arcana) { | 
|  | 82 | +		this.arcana = arcana; | 
|  | 83 | +	} | 
|  | 84 | + | 
|  | 85 | +	@NonNull | 
|  | 86 | +	public Range getRange() { | 
|  | 87 | +		return range; | 
|  | 88 | +	} | 
|  | 89 | + | 
|  | 90 | +	public void setRange(@NonNull final Range range) { | 
|  | 91 | +		this.range = Preconditions.<Range>checkNotNull(range, "range"); //$NON-NLS-1$ | 
|  | 92 | +	} | 
|  | 93 | + | 
|  | 94 | +	public AstNode[] getChildren() { | 
|  | 95 | +		return children; | 
|  | 96 | +	} | 
|  | 97 | + | 
|  | 98 | +	public void setChildren(final AstNode[] children) { | 
|  | 99 | +		this.children = children; | 
|  | 100 | +	} | 
|  | 101 | + | 
|  | 102 | +	@Override | 
|  | 103 | +	public String toString() { | 
|  | 104 | +		ToStringBuilder b = new ToStringBuilder(this); | 
|  | 105 | +		b.add("role", this.role); //$NON-NLS-1$ | 
|  | 106 | +		b.add("kind", this.kind); //$NON-NLS-1$ | 
|  | 107 | +		b.add("detail", this.detail); //$NON-NLS-1$ | 
|  | 108 | +		b.add("arcana", this.arcana); //$NON-NLS-1$ | 
|  | 109 | +		b.add("range", this.range); //$NON-NLS-1$ | 
|  | 110 | +		b.add("children", this.children); //$NON-NLS-1$ | 
|  | 111 | +		return b.toString(); | 
|  | 112 | +	} | 
|  | 113 | + | 
|  | 114 | +	@Override | 
|  | 115 | +	public boolean equals(final Object obj) { | 
|  | 116 | +		if (this == obj) | 
|  | 117 | +			return true; | 
|  | 118 | +		if (obj == null) | 
|  | 119 | +			return false; | 
|  | 120 | +		if (getClass() != obj.getClass()) | 
|  | 121 | +			return false; | 
|  | 122 | +		AstNode other = (AstNode) obj; | 
|  | 123 | +		if (this.role == null) { | 
|  | 124 | +			if (other.role != null) | 
|  | 125 | +				return false; | 
|  | 126 | +		} else if (!this.role.equals(other.role)) | 
|  | 127 | +			return false; | 
|  | 128 | +		if (this.kind == null) { | 
|  | 129 | +			if (other.kind != null) | 
|  | 130 | +				return false; | 
|  | 131 | +		} else if (!this.kind.equals(other.kind)) | 
|  | 132 | +			return false; | 
|  | 133 | +		if (this.detail == null) { | 
|  | 134 | +			if (other.detail != null) | 
|  | 135 | +				return false; | 
|  | 136 | +		} else if (!this.detail.equals(other.detail)) | 
|  | 137 | +			return false; | 
|  | 138 | +		if (this.arcana == null) { | 
|  | 139 | +			if (other.arcana != null) | 
|  | 140 | +				return false; | 
|  | 141 | +		} else if (!this.arcana.equals(other.arcana)) | 
|  | 142 | +			return false; | 
|  | 143 | +		if (this.range == null) { | 
|  | 144 | +			if (other.range != null) | 
|  | 145 | +				return false; | 
|  | 146 | +		} else if (!this.range.equals(other.range)) | 
|  | 147 | +			return false; | 
|  | 148 | +		if (this.children == null) { | 
|  | 149 | +			if (other.children != null) | 
|  | 150 | +				return false; | 
|  | 151 | +		} else if (!Arrays.deepEquals(this.children, other.children)) | 
|  | 152 | +			return false; | 
|  | 153 | +		return true; | 
|  | 154 | +	} | 
|  | 155 | + | 
|  | 156 | +	@Override | 
|  | 157 | +	public int hashCode() { | 
|  | 158 | +		final int prime = 31; | 
|  | 159 | +		int result = 1; | 
|  | 160 | +		result = prime * result + ((this.role == null) ? 0 : this.role.hashCode()); | 
|  | 161 | +		result = prime * result + ((this.kind == null) ? 0 : this.kind.hashCode()); | 
|  | 162 | +		result = prime * result + ((this.detail == null) ? 0 : this.detail.hashCode()); | 
|  | 163 | +		result = prime * result + ((this.arcana == null) ? 0 : this.arcana.hashCode()); | 
|  | 164 | +		result = prime * result + ((this.range == null) ? 0 : this.range.hashCode()); | 
|  | 165 | +		return prime * result + ((this.children == null) ? 0 : Arrays.deepHashCode(this.children)); | 
|  | 166 | +	} | 
|  | 167 | +} | 
0 commit comments