com.cerner.ccl.parser.text.smoosh.IndexedSmoosher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdoc-parser Show documentation
Show all versions of cdoc-parser Show documentation
A parser utility for parsing CDoc CCL documentation
The newest version!
package com.cerner.ccl.parser.text.smoosh;
import java.util.List;
/**
* An index-driven smoosher. An instance of this object should be treated as stateful.
*
* @author Joshua Hyde
*
* @param
* The type of object to be produced as a result of smooshing.
*/
public interface IndexedSmoosher {
/**
* Determine whether or not this object can smoosh content starting with the given line.
*
* @param line
* The line at the beginning of the collection of text to be smooshed.
* @return {@code true} if the content begun by this line can be smooshed; {@code false} if not.
* @throws IllegalArgumentException
* If the given line is {@code null}.
*/
boolean canSmoosh(String line);
/**
* Smoosh a list together.
*
* @param startingIndex
* The index of the given list at which to start.
* @param list
* A {@link List} of {@link String} objects that are to be smooshed.
* @return A {@code T} product of the smooshing.
* @throws IllegalArgumentException
* If:
*
* - The starting index is negative
* - The given list is {@code null}
* - The list is empty
* - The starting index is too high for the given list
*
*/
T smoosh(int startingIndex, List list);
/**
* Get the last index examined during {@link #smoosh(int, List) smooshing}.
*
* @return The last-examined index.
* @throws IllegalStateException
* If {@link #smoosh(int, List)} has not been previously successfully called on this object.
*/
int getEndingIndex();
}