diff --git a/src/main/java/org/codejive/properties/Cursor.java b/src/main/java/org/codejive/properties/Cursor.java index f9872c3..4278e38 100644 --- a/src/main/java/org/codejive/properties/Cursor.java +++ b/src/main/java/org/codejive/properties/Cursor.java @@ -168,12 +168,25 @@ public int prevCount(Predicate accept) { return cnt; } + /** + * 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). + *
+ * This method advances the cursor by one, such that the cursor state remains unchanged (pointing to the same token as before). + * @param token the token to insert. + * @return {@code this} + */ public Cursor add(PropertiesParser.Token token) { index = Math.max(index, 0); addToken(index++, token); return this; } + /** + * Inserts an EOL Token at the current position. + * @see #add(PropertiesParser.Token) + * @param eolType the line separator used for the token. Typically {@link Properties#getEolType()} + * @return {@code this} + */ public Cursor addEol(EolType eolType) { return add(eolType.token); }