T - the type of objects this parser yieldspublic class HCParser<T>
extends java.lang.Object
HCParser parses textual input using a root ChildReader. This is useful to convert Hash Code's
input file into an object representation of the problem.| Constructor | Description |
|---|---|
HCParser(@NotNull ObjectReader<T> rootReader) |
Creates a new
HCParser with the default configuration. |
HCParser(@NotNull ObjectReader<T> rootReader,
java.lang.String separator) |
Creates a new
HCParser using the given separator. |
HCParser(@NotNull ObjectReader<T> rootReader,
Config config) |
Creates a new
HCParser with the given configuration. |
| Modifier and Type | Method | Description |
|---|---|---|
T |
parse(java.io.Reader inputReader) |
Creates an instance of T by reading the input from the given
Reader. |
T |
parse(java.lang.String content) |
Parses the given input to create an instance of T.
|
T |
parse(Context context) |
Creates an instance of T by reading the input from the given
Context. |
T |
parseFile(java.lang.String filename) |
Parses the given file to create an instance of T.
|
public HCParser(@NotNull
@NotNull ObjectReader<T> rootReader)
HCParser with the default configuration.rootReader - the reader to use to read the input into an objectpublic HCParser(@NotNull
@NotNull ObjectReader<T> rootReader,
java.lang.String separator)
HCParser using the given separator.rootReader - the reader to use to read the input into an objectseparator - the separator between elements within an input linepublic HCParser(@NotNull
@NotNull ObjectReader<T> rootReader,
Config config)
HCParser with the given configuration.rootReader - the reader to use to read the input into an objectconfig - the configuration defining this parser's behaviourpublic T parseFile(java.lang.String filename) throws java.io.FileNotFoundException
filename - the path to the file to parsejava.io.FileNotFoundException - if the given file does not existpublic T parse(java.lang.String content)
content - the input to parsepublic T parse(java.io.Reader inputReader)
Reader.inputReader - the Reader to use to consume the input