Skip to content

Commit 2c69abc

Browse files
docs: add javadoc to Cursor#add and Cursor#addEol (#76)
1 parent 2bc6fd1 commit 2c69abc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎src/main/java/org/codejive/properties/Cursor.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,25 @@ public int prevCount(Predicate<PropertiesParser.Token> accept) {
168168
return cnt;
169169
}
170170

171+
/**
172+
* Inserts a token at the current position, shifting the current token (if any) and any subsequent tokens to the right (adds one to their indices).
173+
* <br/>
174+
* This method advances the cursor by one, such that the cursor state remains unchanged (pointing to the same token as before).
175+
* @param token the token to insert.
176+
* @return {@code this}
177+
*/
171178
public Cursor add(PropertiesParser.Token token) {
172179
index = Math.max(index, 0);
173180
addToken(index++, token);
174181
return this;
175182
}
176183

184+
/**
185+
* Inserts an EOL Token at the current position.
186+
* @see #add(PropertiesParser.Token)
187+
* @param eolType the line separator used for the token. Typically {@link Properties#getEolType()}
188+
* @return {@code this}
189+
*/
177190
public Cursor addEol(EolType eolType) {
178191
return add(eolType.token);
179192
}

0 commit comments

Comments
 (0)