@ParametersAreNonnullByDefault public abstract class OTUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <I,D> void |
displayHTMLInBrowser(ObservationTable<I,D> table) |
static <I,D> void |
displayHTMLInBrowser(ObservationTable<I,D> table,
Function<? super Word<? extends I>,? extends String> wordToString,
Function<? super D,? extends String> outputToString)
Displays the observation table as a HTML document in the default browser.
|
static <I,D> ObservationTable<I,D> |
fromString(String source,
Alphabet<I> alphabet,
ObservationTableReader<I,D> reader) |
static <I,D> String |
toString(ObservationTable<? extends I,? extends D> table,
ObservationTableWriter<I,D> writer) |
static <I,D> void |
writeHTMLToFile(ObservationTable<I,D> table,
File file) |
static <I,D> void |
writeHTMLToFile(ObservationTable<I,D> table,
File file,
Function<? super Word<? extends I>,? extends String> wordToString,
Function<? super D,? extends String> outputToString) |
public static <I,D> String toString(ObservationTable<? extends I,? extends D> table, ObservationTableWriter<I,D> writer)
public static <I,D> ObservationTable<I,D> fromString(String source, Alphabet<I> alphabet, ObservationTableReader<I,D> reader)
public static <I,D> void writeHTMLToFile(ObservationTable<I,D> table, File file, Function<? super Word<? extends I>,? extends String> wordToString, Function<? super D,? extends String> outputToString) throws IOException
IOException
public static <I,D> void writeHTMLToFile(ObservationTable<I,D> table, File file) throws IOException
IOException
public static <I,D> void displayHTMLInBrowser(ObservationTable<I,D> table, Function<? super Word<? extends I>,? extends String> wordToString, Function<? super D,? extends String> outputToString) throws IOException, HeadlessException, UnsupportedOperationException
This method internally relies on Desktop.browse(java.net.URI)
, hence it will not
work if Desktop
is not supported, or if the application is running in headless mode.
IMPORTANT NOTE: Calling this method may delay the termination of the JVM by up to 5 seconds. This is due to the fact that the temporary file created in this method is marked for deletion upon JVM termination. If the JVM terminates too early, it might be deleted before it was loaded by the browser.
table
- the observation table to displaywordToString
- the transformation from words to strings. This transformation is not required
nor expected to escape HTML entitiesoutputToString
- the transformation from outputs to strings. This transformation is not required
nor expected to escape HTML entitiesIOException
- if creating or writing to the temporary file failsHeadlessException
- if the JVM is running in headless modeUnsupportedOperationException
- if Desktop.getDesktop()
is not supported by the systempublic static <I,D> void displayHTMLInBrowser(ObservationTable<I,D> table) throws IOException, HeadlessException, UnsupportedOperationException
Copyright © 2015. All rights reserved.