public final class ProblemSolver extends NamedObject
ProblemSolver
is an object that
for a given Problem
instance provides :
IFile
which correspond to the solver source codeProblemSampleDataset
which contains testing input and output.Modifier and Type | Field and Description |
---|---|
private ProblemSampleDataset |
dataset
Sample dataset associated to this solver.
|
private static java.lang.String |
DATASET_TASK
Task name for the dataset retrieval.
|
private static java.util.Map<Problem,java.lang.ref.SoftReference<ProblemSolver>> |
INSTANCES
Cache of all problem solver instances indexed by
|
private static java.lang.String |
PROJECT_TASK
Task name for the project retrieval.
|
private static long |
serialVersionUID
Serialization index.
|
private org.eclipse.core.resources.IFile |
solver
Target solver class file.
|
private static java.lang.String |
SOLVER_TASK
Task name for the solver retrieval.
|
Modifier | Constructor and Description |
---|---|
private |
ProblemSolver(java.lang.String name,
org.eclipse.core.resources.IFile solver,
ProblemSampleDataset dataset)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private static ProblemSolver |
createSolver(Problem problem,
org.eclipse.core.runtime.IProgressMonitor monitor)
Static factory method that creates a
ProblemSolver instance
from the given problem instance. |
static ProblemSolver |
get(Problem problem,
org.eclipse.core.runtime.IProgressMonitor monitor)
ProblemSolver instances access method. |
org.eclipse.core.resources.IFile |
getFile()
Getter for the solver class file.
|
org.eclipse.core.resources.IProject |
getProject()
Retrieves and returns
IProject instance the solver class belongs to. |
ProblemSampleDataset |
getSampleDataset()
Getter for the solver sample dataset.
|
getName, getName
private static final long serialVersionUID
private final org.eclipse.core.resources.IFile solver
private final ProblemSampleDataset dataset
private static final java.util.Map<Problem,java.lang.ref.SoftReference<ProblemSolver>> INSTANCES
private static final java.lang.String PROJECT_TASK
private static final java.lang.String SOLVER_TASK
private static final java.lang.String DATASET_TASK
private ProblemSolver(java.lang.String name, org.eclipse.core.resources.IFile solver, ProblemSampleDataset dataset)
name
- Name of the target project.solver
- Target solver class file.dataset
- Sample dataset associated to this solver.public org.eclipse.core.resources.IFile getFile()
solver
public org.eclipse.core.resources.IProject getProject()
IProject
instance the solver class belongs to.IProject
instance the solver class file belongs to.IResource.getProject()
public ProblemSampleDataset getSampleDataset()
dataset
private static ProblemSolver createSolver(Problem problem, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
ProblemSolver
instance
from the given problem instance. Creates project, solver, and
dataset.problem
- Problem to build solver from.monitor
- Monitor instance used for each builder involved.org.eclipse.core.runtime.CoreException
- If any error occurs while creating solver.public static ProblemSolver get(Problem problem, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
ProblemSolver
instances access method. If the required instance
does not exist, or has been garbaged, then a new instance is created and put
into the local cache.problem
- Problem to get solver instance from.monitor
- Monitor instance used if solver creation is required.org.eclipse.core.runtime.CoreException
- If any error occurs while creating required instance.