Skip to content

Commit bbe118f

Browse files
committed
Javadoc
1 parent 677e57f commit bbe118f

File tree

9 files changed

+71
-92
lines changed

9 files changed

+71
-92
lines changed

src/main/java/org/apache/commons/text/diff/CommandVisitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,21 @@ public interface CommandVisitor<T> {
125125
/**
126126
* Method called when a delete command is encountered.
127127
*
128-
* @param object object to delete (this object comes from the first sequence)
128+
* @param object object to delete (this object comes from the first sequence).
129129
*/
130130
void visitDeleteCommand(T object);
131131

132132
/**
133133
* Method called when an insert command is encountered.
134134
*
135-
* @param object object to insert (this object comes from the second sequence)
135+
* @param object object to insert (this object comes from the second sequence).
136136
*/
137137
void visitInsertCommand(T object);
138138

139139
/**
140140
* Method called when a keep command is encountered.
141141
*
142-
* @param object object to keep (this object comes from the first sequence)
142+
* @param object object to keep (this object comes from the first sequence).
143143
*/
144144
void visitKeepCommand(T object);
145145

src/main/java/org/apache/commons/text/diff/DeleteCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class DeleteCommand<T> extends EditCommand<T> {
3636
/**
3737
* Constructs a new instance of {@link DeleteCommand}.
3838
*
39-
* @param object the object of the first sequence that should be deleted
39+
* @param object the object of the first sequence that should be deleted.
4040
*/
4141
public DeleteCommand(final T object) {
4242
super(object);
@@ -46,7 +46,7 @@ public DeleteCommand(final T object) {
4646
* Accepts a visitor. When a {@code DeleteCommand} accepts a visitor, it calls
4747
* its {@link CommandVisitor#visitDeleteCommand visitDeleteCommand} method.
4848
*
49-
* @param visitor the visitor to be accepted
49+
* @param visitor the visitor to be accepted.
5050
*/
5151
@Override
5252
public void accept(final CommandVisitor<T> visitor) {

src/main/java/org/apache/commons/text/diff/EditCommand.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public abstract class EditCommand<T> {
5858
/**
5959
* Constructs a new instance of EditCommand.
6060
*
61-
* @param object reference to the object associated with this command, this
62-
* refers to an element of one of the sequences being compared
61+
* @param object reference to the object associated with this command, this refers to an element of one of the sequences being compared.
6362
*/
6463
protected EditCommand(final T object) {
6564
this.object = object;
@@ -68,18 +67,17 @@ protected EditCommand(final T object) {
6867
/**
6968
* Accepts a visitor.
7069
* <p>
71-
* This method is invoked for each commands belonging to
72-
* an {@link EditScript EditScript}, in order to implement the visitor design pattern
70+
* This method is invoked for each commands belonging to an {@link EditScript EditScript}, in order to implement the visitor design pattern
7371
* </p>
7472
*
75-
* @param visitor the visitor to be accepted
73+
* @param visitor the visitor to be accepted.
7674
*/
7775
public abstract void accept(CommandVisitor<T> visitor);
7876

7977
/**
8078
* Gets the object associated with this command.
8179
*
82-
* @return The object on which the command is applied
80+
* @return The object on which the command is applied.
8381
*/
8482
protected T getObject() {
8583
return object;

src/main/java/org/apache/commons/text/diff/EditScript.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public EditScript() {
6767
/**
6868
* Appends a delete command to the script.
6969
*
70-
* @param command command to add
70+
* @param command command to add.
7171
*/
7272
public void append(final DeleteCommand<T> command) {
7373
commands.add(command);
@@ -77,7 +77,7 @@ public void append(final DeleteCommand<T> command) {
7777
/**
7878
* Appends an insert command to the script.
7979
*
80-
* @param command command to add
80+
* @param command command to add.
8181
*/
8282
public void append(final InsertCommand<T> command) {
8383
commands.add(command);
@@ -87,7 +87,7 @@ public void append(final InsertCommand<T> command) {
8787
/**
8888
* Appends a keep command to the script.
8989
*
90-
* @param command command to add
90+
* @param command command to add.
9191
*/
9292
public void append(final KeepCommand<T> command) {
9393
commands.add(command);
@@ -99,7 +99,7 @@ public void append(final KeepCommand<T> command) {
9999
* longest common subsequence is the number of {@link KeepCommand keep
100100
* commands} in the script.
101101
*
102-
* @return length of the Longest Common Subsequence
102+
* @return length of the Longest Common Subsequence.
103103
*/
104104
public int getLCSLength() {
105105
return lcsLength;
@@ -110,7 +110,7 @@ public int getLCSLength() {
110110
* modification is the number of {@link DeleteCommand delete} and
111111
* {@link InsertCommand insert} commands in the script.
112112
*
113-
* @return number of effective modifications
113+
* @return number of effective modifications.
114114
*/
115115
public int getModifications() {
116116
return modifications;
@@ -123,7 +123,7 @@ public int getModifications() {
123123
* commands in order and call the appropriate method as each command is
124124
* encountered.
125125
*
126-
* @param visitor the visitor that will visit all commands in turn
126+
* @param visitor the visitor that will visit all commands in turn.
127127
*/
128128
public void visit(final CommandVisitor<T> visitor) {
129129
commands.forEach(command -> command.accept(visitor));

src/main/java/org/apache/commons/text/diff/InsertCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class InsertCommand<T> extends EditCommand<T> {
3636
/**
3737
* Constructs a new instance of InsertCommand.
3838
*
39-
* @param object the object of the second sequence that should be inserted
39+
* @param object the object of the second sequence that should be inserted.
4040
*/
4141
public InsertCommand(final T object) {
4242
super(object);
@@ -47,7 +47,7 @@ public InsertCommand(final T object) {
4747
* it calls its {@link CommandVisitor#visitInsertCommand visitInsertCommand}
4848
* method.
4949
*
50-
* @param visitor the visitor to be accepted
50+
* @param visitor the visitor to be accepted.
5151
*/
5252
@Override
5353
public void accept(final CommandVisitor<T> visitor) {

src/main/java/org/apache/commons/text/diff/KeepCommand.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ public class KeepCommand<T> extends EditCommand<T> {
3636
/**
3737
* Constructs a new instance of KeepCommand.
3838
*
39-
* @param object the object belonging to both sequences (the object is a
40-
* reference to the instance in the first sequence which is known
41-
* to be equal to an instance in the second sequence)
39+
* @param object the object belonging to both sequences (the object is a reference to the instance in the first sequence which is known to be equal to an
40+
* instance in the second sequence)
4241
*/
4342
public KeepCommand(final T object) {
4443
super(object);
4544
}
4645

4746
/**
48-
* Accepts a visitor. When a {@code KeepCommand} accepts a visitor, it
49-
* calls its {@link CommandVisitor#visitKeepCommand visitKeepCommand} method.
47+
* Accepts a visitor. When a {@code KeepCommand} accepts a visitor, it calls its {@link CommandVisitor#visitKeepCommand visitKeepCommand} method.
5048
*
51-
* @param visitor the visitor to be accepted
49+
* @param visitor the visitor to be accepted.
5250
*/
5351
@Override
5452
public void accept(final CommandVisitor<T> visitor) {

src/main/java/org/apache/commons/text/diff/ReplacementsFinder.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ public class ReplacementsFinder<T> implements CommandVisitor<T> {
7272
/**
7373
* Constructs a new instance of {@link ReplacementsFinder}.
7474
*
75-
* @param handler handler to call when synchronized sequences are found
75+
* @param handler handler to call when synchronized sequences are found
7676
*/
7777
public ReplacementsFinder(final ReplacementsHandler<T> handler) {
7878
pendingInsertions = new ArrayList<>();
79-
pendingDeletions = new ArrayList<>();
80-
skipped = 0;
81-
this.handler = handler;
79+
pendingDeletions = new ArrayList<>();
80+
skipped = 0;
81+
this.handler = handler;
8282
}
8383

8484
/**
8585
* Add an object to the pending deletions set.
8686
*
87-
* @param object object to delete
87+
* @param object object to delete.
8888
*/
8989
@Override
9090
public void visitDeleteCommand(final T object) {
@@ -94,7 +94,7 @@ public void visitDeleteCommand(final T object) {
9494
/**
9595
* Add an object to the pending insertions set.
9696
*
97-
* @param object object to insert
97+
* @param object object to insert.
9898
*/
9999
@Override
100100
public void visitInsertCommand(final T object) {
@@ -104,11 +104,10 @@ public void visitInsertCommand(final T object) {
104104
/**
105105
* Handle a synchronization object.
106106
* <p>
107-
* When a synchronization object is identified, the pending insertions and
108-
* pending deletions sets are provided to the user handler as subsequences.
107+
* When a synchronization object is identified, the pending insertions and pending deletions sets are provided to the user handler as subsequences.
109108
* </p>
110109
*
111-
* @param object synchronization object detected
110+
* @param object synchronization object detected.
112111
*/
113112
@Override
114113
public void visitKeepCommand(final T object) {

src/main/java/org/apache/commons/text/diff/ReplacementsHandler.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.text.diff;
1819

1920
import java.util.List;
@@ -30,25 +31,18 @@ public interface ReplacementsHandler<T> {
3031
/**
3132
* Handle two synchronized sequences.
3233
* <p>
33-
* This method is called by a {@link ReplacementsFinder ReplacementsFinder}
34-
* instance when it has synchronized two sub-sequences of object arrays
35-
* being compared, and at least one of the sequences is non-empty. Since the
36-
* sequences are synchronized, the objects before the two sub-sequences are
37-
* equals (if they exist). This property also holds for the objects after
38-
* the two sub-sequences.
34+
* This method is called by a {@link ReplacementsFinder ReplacementsFinder} instance when it has synchronized two sub-sequences of object arrays being
35+
* compared, and at least one of the sequences is non-empty. Since the sequences are synchronized, the objects before the two sub-sequences are equals (if
36+
* they exist). This property also holds for the objects after the two sub-sequences.
3937
* </p>
4038
* <p>
41-
* The replacement is defined as replacing the {@code from}
42-
* sub-sequence into the {@code to} sub-sequence.
39+
* The replacement is defined as replacing the {@code from} sub-sequence into the {@code to} sub-sequence.
4340
* </p>
4441
*
45-
* @param skipped number of tokens skipped since the last call (i.e. number of
46-
* tokens that were in both sequences), this number should be strictly positive
47-
* except on the very first call where it can be zero (if the first object of
48-
* the two sequences are different)
49-
* @param from sub-sequence of objects coming from the first sequence
50-
* @param to sub-sequence of objects coming from the second sequence
42+
* @param skipped number of tokens skipped since the last call (i.e. number of tokens that were in both sequences), this number should be strictly positive
43+
* except on the very first call where it can be zero (if the first object of the two sequences are different).
44+
* @param from sub-sequence of objects coming from the first sequence.
45+
* @param to sub-sequence of objects coming from the second sequence.
5146
*/
5247
void handleReplacement(int skipped, List<T> from, List<T> to);
53-
5448
}

0 commit comments

Comments
 (0)