public abstract class AbstractOperator extends Object implements IOperator
PlotOperators and ImageOperators inherit from this
class.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isCancelable
A flag, whether the operator can be cancelled or not.
|
protected String |
name
The cached unique name of the operator.
|
protected AbstractProcessingTask |
parentTask
A reference to the task, an operator is executed in.
|
protected PropertyChangeSupport |
pcs
PropertyChangeSupport for the Operator class. |
protected OperatorType |
type
The type of the operator.
|
| Constructor and Description |
|---|
AbstractOperator() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProgressListener(PropertyChangeListener listener,
String propertyName)
Adds the
IProgressListener for the given property name. |
void |
fireProgressChanged(int progress)
Fire the progress of the operator to any
IProgressListener. |
abstract String |
getName()
Gets the unique name of the
IOperator by returning the
"GlobalName" element from the resources[][] of the
associated IOperatorDescriptor. |
AbstractProcessingTask |
getParentTask()
Get the executing task of this operator.
|
PropertyChangeSupport |
getPcs()
Get the
PropertyChangeSupport for this object. |
PropertyChangeListener[] |
getProgressListeners(String propertyName)
List all registered
IProgressListeners for a given property
name. |
abstract OperatorType |
getType()
Gets the type of the operator listed in an enumeration.
|
protected void |
initializeOperator()
Common initialization method for all operators.
|
boolean |
isCancelable() |
boolean |
isCancelled(AbstractProcessingTask task)
This method should be invoked within long-running operators which shall
be cancelled at certain execution stages.
|
abstract IResult |
run(IWorkPackage wp)
This method contains the entire logic (algorithm) of the operator.
|
void |
setCancelable(boolean isCancelable) |
void |
setParentTask(AbstractProcessingTask parentTask)
Set the executing task of this operator.
|
protected String name
protected OperatorType type
protected AbstractProcessingTask parentTask
protected boolean isCancelable
true.protected PropertyChangeSupport pcs
PropertyChangeSupport for the Operator class. Use this variable
to emit property changes like status updates from 0 to 100%.protected void initializeOperator()
true per default.public abstract IResult run(IWorkPackage wp) throws Exception
IOperatorIOperator does not declare any class members, since the execution
of this code must be thread-safe.public abstract String getName()
IOperatorIOperator by returning the
"GlobalName" element from the resources[][] of the
associated IOperatorDescriptor.public abstract OperatorType getType()
IOperatorgetType in interface IOperatorOperatorTypepublic void setParentTask(AbstractProcessingTask parentTask)
IOperatorsetParentTask in interface IOperatorpublic AbstractProcessingTask getParentTask()
IOperatorgetParentTask in interface IOperatorpublic boolean isCancelled(AbstractProcessingTask task)
isCancelled in interface ICancelableICancelable.isCancelled(AbstractProcessingTask)public boolean isCancelable()
isCancelable in interface ICancelablepublic void setCancelable(boolean isCancelable)
setCancelable in interface ICancelableisCancelable - the isCancelable to setpublic PropertyChangeSupport getPcs()
PropertyChangeSupport for this object.public void addProgressListener(PropertyChangeListener listener, String propertyName)
IProgressEmitterIProgressListener for the given property name.addProgressListener in interface IProgressEmitterlistener - the IProgressListener to be addedpropertyName - the name of the property declared in the corresponding
PropertyChangeEvent, or null if the
IProgressListener shall receive all events.public PropertyChangeListener[] getProgressListeners(String propertyName)
IProgressEmitterIProgressListeners for a given property
name.getProgressListeners in interface IProgressEmitterpropertyName - the name of the property declared in the corresponding
PropertyChangeEvent, or null if all
IProgressListeners shall be retrieved.IProgressListenerspublic void fireProgressChanged(int progress)
IProgressEmitterIProgressListener.fireProgressChanged in interface IProgressEmitterCopyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.