Skip to content

Commit a380f43

Browse files
committed
Issue 102: Add comment nodes eveywhere. Add a new field in CompilationUnit to capture package information.
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
1 parent 5669284 commit a380f43

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.settings/org.eclipse.jdt.core.prefs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=ignore
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4+
org.eclipse.jdt.core.compiler.compliance=11
5+
org.eclipse.jdt.core.compiler.source=11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.ibm.cldk.entities;
2+
3+
import lombok.Data;
4+
5+
/**
6+
* Represents a comment entity extracted from source code.
7+
* This class encapsulates information about the content, position,
8+
* and type of a comment within a source file.
9+
*
10+
* <p>
11+
* The comment can be of various types, including Javadoc, block comments, or line comments.
12+
* The class also keeps track of the comment's position within the file (line and column numbers).
13+
* </p>
14+
*
15+
* <p>
16+
* This class leverages Lombok's {@code @Data} annotation to automatically generate
17+
* getters, setters, {@code toString()}, {@code equals()}, and {@code hashCode()} methods.
18+
* </p>
19+
*
20+
* Example usage:
21+
* <pre>
22+
* Comment comment = new Comment();
23+
* comment.setContent("This is a sample comment.");
24+
* comment.setStartLine(10);
25+
* comment.setEndLine(12);
26+
* comment.setJavadoc(true);
27+
* </pre>
28+
*
29+
* @author Rahul Krishna
30+
* @version 2.3.0
31+
*/
32+
@Data
33+
public class Comment {
34+
35+
/**
36+
* The textual content of the comment.
37+
*/
38+
private String content;
39+
40+
/**
41+
* The starting line number of the comment in the source file.
42+
* <p>
43+
* Defaults to {@code -1} if the position is unknown.
44+
* </p>
45+
*/
46+
private int startLine = -1;
47+
48+
/**
49+
* The ending line number of the comment in the source file.
50+
* <p>
51+
* Defaults to {@code -1} if the position is unknown.
52+
* </p>
53+
*/
54+
private int endLine = -1;
55+
56+
/**
57+
* The starting column number of the comment in the source file.
58+
* <p>
59+
* Defaults to {@code -1} if the position is unknown.
60+
* </p>
61+
*/
62+
private int startColumn = -1;
63+
64+
/**
65+
* The ending column number of the comment in the source file.
66+
* <p>
67+
* Defaults to {@code -1} if the position is unknown.
68+
* </p>
69+
*/
70+
private int endColumn = -1;
71+
72+
/**
73+
* Indicates whether the comment is a Javadoc comment.
74+
* <p>
75+
* Javadoc comments are special block comments used for generating documentation
76+
* and typically start with {@code /**}.
77+
* </p>
78+
*/
79+
private boolean isJavadoc = false;
80+
}

0 commit comments

Comments
 (0)