public abstract class EditableJobContainerAdapter extends JobAdapter implements EditableJobContainer
JobAdapter
, except that additional functionality to add and remove sub-jobs is already implemented, as well as
the initialization and uninitialization of these sub-jobs.
The sub-jobs can be accessed (e.g. the function Job.executeJob(ExecutionInformation, Microscope, MeasurementContext)
) via getJobs()
.Constructor and Description |
---|
EditableJobContainerAdapter(PositionInformation positionInformation)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addJob(Job job)
Adds a job to the end of the container.
|
void |
clearJobs()
Removes all jobs from this container.
|
Job |
getJob(int jobIndex)
Returns the job at the given index in this container.
|
Job[] |
getJobs()
Returns a list of all jobs contained in this container.
|
int |
getNumJobs()
Returns the number of jobs in this container.
|
void |
initializeJob(Microscope microscope,
MeasurementContext measurementContext)
When overwriting this function, the base implementation should be called at the beginning, i.e.
|
void |
insertJob(Job job,
int jobIndex)
Inserts a job at the given index.
|
void |
removeJob(Job job)
Removes a previously added job.
|
void |
uninitializeJob(Microscope microscope,
MeasurementContext measurementContext)
When overwriting this function, the base implementation should be called at the beginning, i.e.
|
addJobListener, addMessageListener, assertRunning, executeJob, getDefaultName, getName, getPositionInformation, getUUID, isRunning, removeJobListener, removeMessageListener, runJob, sendErrorMessage, sendMessage, setName
clone, exportObject, exportObject, exportObject, unexportObject
public EditableJobContainerAdapter(PositionInformation positionInformation) throws java.rmi.RemoteException
positionInformation
- The logical position where this job is executed. Must not be null.java.rmi.RemoteException
public void initializeJob(Microscope microscope, MeasurementContext measurementContext) throws JobException, java.lang.InterruptedException, java.rmi.RemoteException
JobAdapter
initializeJob
in interface Job
initializeJob
in class JobAdapter
microscope
- Interface to control and get information of the microscope.measurementContext
- the context of the measurement, allowing to transfer data between measurement components and similar.JobException
java.lang.InterruptedException
java.rmi.RemoteException
public void uninitializeJob(Microscope microscope, MeasurementContext measurementContext) throws JobException, java.lang.InterruptedException, java.rmi.RemoteException
JobAdapter
uninitializeJob
in interface Job
uninitializeJob
in class JobAdapter
microscope
- Interface to control and get information of the microscope.measurementContext
- the context of the measurement, allowing to transfer data between measurement components and similar.JobException
java.lang.InterruptedException
java.rmi.RemoteException
public void addJob(Job job) throws MeasurementRunningException
EditableJobContainer
addJob
in interface EditableJobContainer
job
- The job to be added.MeasurementRunningException
- Thrown if job could not be added, e.g. because measurement is already running.public void removeJob(Job job) throws MeasurementRunningException
EditableJobContainer
removeJob
in interface EditableJobContainer
job
- The job to be removed.MeasurementRunningException
- Thrown if job could not be removed, e.g. because measurement is already running.public void clearJobs() throws MeasurementRunningException
EditableJobContainer
clearJobs
in interface EditableJobContainer
MeasurementRunningException
- Thrown if jobs could not be removed, e.g. because measurement is already running.public Job[] getJobs()
JobContainer
getJobs
in interface JobContainer
public int getNumJobs()
JobContainer
getNumJobs
in interface JobContainer
public Job getJob(int jobIndex) throws java.lang.IndexOutOfBoundsException
JobContainer
getJob
in interface JobContainer
jobIndex
- Index of job in the container.java.lang.IndexOutOfBoundsException
- Thrown if jobIndex is smaller than zero, or greater or equal to JobContainer.getNumJobs()
.public void insertJob(Job job, int jobIndex) throws MeasurementRunningException, java.lang.IndexOutOfBoundsException
EditableJobContainer
insertJob
in interface EditableJobContainer
job
- The job to be inserted.jobIndex
- Index where the job should be inserted.MeasurementRunningException
- Thrown if job could not be added, e.g. because measurement is already running.java.lang.IndexOutOfBoundsException
- Thrown if index is smaller than zero, or greater or equal JobContainer.getNumJobs()
.