public final class DatasetBuilder
extends java.lang.Object
DatasetBuilder
provides tools for extracting and
creating sample dataset for a given Problem
instance.Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DATASET_INPUT_SUFFIX
Path of the created test input file.
|
private static java.lang.String |
DATASET_OUTPUT_SUFFIX
Path of the created test output file.
|
private org.eclipse.core.resources.IFolder |
folder
Target folder in which dataset will be written.
|
private static java.lang.String |
INPUT_PATH
Path of the input folder in which dataset will be written.
|
private static java.lang.String |
IO_CLASSNAME
Classname of the DIV that contains our testing dataset.
|
private static org.eclipse.core.runtime.IStatus |
IO_NOT_FOUND
Error status thrown when problem dataset could not be found.
|
private org.eclipse.core.runtime.IProgressMonitor |
monitor
Monitor instance used for project creation.
|
private Problem |
problem
Problem instance dataset is built from.
|
private org.eclipse.core.resources.IProject |
project
Target project contribution is made for.
|
Constructor and Description |
---|
DatasetBuilder(Problem problem,
org.eclipse.core.resources.IProject project,
org.eclipse.core.runtime.IProgressMonitor monitor)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ProblemSampleDataset |
build()
Creates input and output dataset associated to the target problem instance.
|
private void |
createFile(org.eclipse.core.resources.IFile file,
java.lang.String content)
Creates a dataset file for the target problem by writing given
content into the given file.
|
private org.jsoup.nodes.Element |
extractDataset()
Extracts and returns the dataset from the problem body.
|
private org.eclipse.core.resources.IFile |
getFile(java.lang.String suffix)
Retrieves file associated to the given problem suffix.
|
private static final java.lang.String INPUT_PATH
private static final java.lang.String IO_CLASSNAME
private static final java.lang.String DATASET_INPUT_SUFFIX
private static final java.lang.String DATASET_OUTPUT_SUFFIX
private static final org.eclipse.core.runtime.IStatus IO_NOT_FOUND
private final org.eclipse.core.resources.IProject project
private final org.eclipse.core.runtime.IProgressMonitor monitor
private final Problem problem
private org.eclipse.core.resources.IFolder folder
public DatasetBuilder(Problem problem, org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
problem
- Problem instance dataset is built from.project
- Target java project to be created.monitor
- Monitor instance used for project creation.private void createFile(org.eclipse.core.resources.IFile file, java.lang.String content) throws org.eclipse.core.runtime.CoreException
file
- File to write content info.content
- Content to write.org.eclipse.core.runtime.CoreException
- If any error occurs while writing file.private org.eclipse.core.resources.IFile getFile(java.lang.String suffix)
suffix
- File name suffix to use for the retrieved file.private org.jsoup.nodes.Element extractDataset() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- If any error occurs while extracing dataset.public ProblemSampleDataset build() throws org.eclipse.core.runtime.CoreException
ProblemSampleDataset
instance built.org.eclipse.core.runtime.CoreException
- If any error occurs while creating dataset files.