|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.udo.cs.yale.operator.Operator
edu.udo.cs.yale.operator.OperatorChain
public abstract class OperatorChain
A chain of operators that is subsequently applied. As an OperatorChain is an
Operator itself it can be arbitrarily nested.
Inheritants can access inner operators by getOperator(int). They
should override getMaxNumberOfInnerOperators() and
getMinNumberOfInnerOperators() which are used for some checks. They
should also override getInnerOperatorCondition() to ensure that all
inner operators get the desired input and return the necessary output for the
next inner operator. You also have to implement getNumberOfSteps()
which is used to estimate the needed runtime of your experiment and for
display purposes in the graphical user interface. Please refer to the YALE
tutorial for a description how to implement your own operator chain.
| Field Summary | |
|---|---|
private java.util.List<AddListener> |
addListeners
|
private java.util.List<Operator> |
operators
The inner operators. |
private int |
stepCounter
|
| Constructor Summary | |
|---|---|
OperatorChain(OperatorDescription description)
Creates an empty operator chain. |
|
| Method Summary | |
|---|---|
void |
addAddListener(AddListener listener)
Adds the given listener. |
int |
addOperator(Operator o)
Adds a new inner operator at the last position. |
void |
addOperator(Operator operator,
int index)
Adds the given operator at the given position. |
IOObject[] |
apply()
Applies all inner operators. |
int |
checkDeprecations()
Will count an the number of deprecated operators, i.e. the operators which Operator.getDeprecationInfo() method does not return null. |
java.lang.Class[] |
checkIO(java.lang.Class[] input)
This method checks if inner operators can handle their input and deliver the necessary output. |
int |
checkNumberOfInnerOperators()
Checks if the number of inner operators lies between MinInnerOps and MaxInnerOps. |
int |
checkProperties()
Will throw an exception if a non optional property has no default value and is not defined by user. |
void |
clearErrorList()
Clears the list of errors. |
void |
clearStepCounter()
Necessary to call at the begin of an overloaded apply(IOContainer). |
Operator |
cloneOperator(java.lang.String name)
Performs a deep clone of this operator chain. |
void |
countStep()
|
protected java.lang.String |
createExperimentTree(int indent,
java.lang.String selfPrefix,
java.lang.String childPrefix,
Operator markOperator,
java.lang.String mark)
Returns this OperatorChain's name and class and the ExperimentTrees of the inner operators. |
void |
delete()
Deletes this operator removing it from the name map. |
void |
experimentFinished()
Called at the end of the experiment. |
void |
experimentStarts()
Called when the experiment starts. |
private void |
fireAddEvent(Operator child)
Notifies all added add listeners that a new child was added. |
java.util.List<Operator> |
getAllInnerOperators()
Returns recursively all child operators independently if they are activated or not. |
private java.lang.Class[] |
getAllOutputClasses(java.lang.Class[] innerOutput)
Helper method if in addition to the created output the inner output should also be returned. |
int |
getCurrentStep()
|
int |
getIndexOfOperator(Operator operator,
boolean useDeselected)
|
abstract InnerOperatorCondition |
getInnerOperatorCondition()
Must return a condition of the IO behaviour of all desired inner operators. |
Operator |
getInnerOperatorForName(java.lang.String name)
Returns the inner operator named name or null if no such operator exists. |
protected java.lang.String |
getInnerOperatorsXML(java.lang.String indent)
Writes the XML representation of the inner operators. |
abstract int |
getMaxNumberOfInnerOperators()
Returns the maximum number of innner operators. |
abstract int |
getMinNumberOfInnerOperators()
Returns the minimum number of innner operators. |
int |
getNumberOfAllOperators()
Returns the number of all inner operators (including the disabled operators). |
int |
getNumberOfChildrensSteps()
|
int |
getNumberOfOperators()
Returns the number of all enabled inner operators. |
abstract int |
getNumberOfSteps()
Returns the number of steps performed by this chain. |
Operator |
getOperator(int i)
Returns the i-th inner operator. |
Operator |
getOperatorFromAll(int i)
Returns the i-th operator. |
java.util.Iterator<Operator> |
getOperators()
Returns an iterator over all Operators. |
boolean |
isEnabled()
Returns true if this operator is enabled. |
void |
performAdditionalChecks()
This method invokes the additional check method for each child. |
void |
removeAddListener(AddListener listener)
Removes the given listener. |
void |
removeOperator(Operator operator)
Removes the given operator from this operator chain. |
void |
setEnabled(boolean enabled)
Sets the activation mode. |
void |
setExperiment(Experiment experiment)
Sets the experiment for this operator chain and for all children. |
boolean |
shouldReturnInnerOutput()
Indicates if inner output should be delivered by this operator chain. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.util.List<Operator> operators
private java.util.List<AddListener> addListeners
private int stepCounter
| Constructor Detail |
|---|
public OperatorChain(OperatorDescription description)
| Method Detail |
|---|
public abstract int getMaxNumberOfInnerOperators()
public abstract int getMinNumberOfInnerOperators()
public abstract InnerOperatorCondition getInnerOperatorCondition()
SimpleChainInnerOperatorCondition. More than one
condition should be combined with help of the class
CombinedInnerOperatorCondition.
public abstract int getNumberOfSteps()
getNumberOfSteps in class Operatorpublic void addAddListener(AddListener listener)
public void removeAddListener(AddListener listener)
private void fireAddEvent(Operator child)
public Operator cloneOperator(java.lang.String name)
cloneOperator in class Operatorpublic void setExperiment(Experiment experiment)
setExperiment in class Operator
public final java.lang.Class[] checkIO(java.lang.Class[] input)
throws IllegalInputException,
WrongNumberOfInnerOperatorsException
shouldReturnInnerOutput() this method returns
getDeliveredOutputClasses() if the
output of the inner operators should not be returned.getAllOutputClasses(Class[] innerOutput)
if the output of the inner operators (innerOutput) should also be
returned.
checkIO in class OperatorIllegalInputException
WrongNumberOfInnerOperatorsExceptionpublic boolean shouldReturnInnerOutput()
Operator.getDeliveredOutputClasses() but of
getAllOutputClasses(Class[]).
private java.lang.Class[] getAllOutputClasses(java.lang.Class[] innerOutput)
checkIO(Class[] input).
public int addOperator(Operator o)
public void addOperator(Operator operator,
int index)
public void removeOperator(Operator operator)
public Operator getOperator(int i)
public java.util.Iterator<Operator> getOperators()
public java.util.List<Operator> getAllInnerOperators()
public int getNumberOfOperators()
public int getNumberOfAllOperators()
getNumberOfOperators().
public Operator getOperatorFromAll(int i)
getOperator(int i) this method also uses disabled operators.
Mainly used for GUI purposes. Other operators should use the method
getOperator(int i) which only delivers enabled inner operators.
public int getIndexOfOperator(Operator operator,
boolean useDeselected)
public Operator getInnerOperatorForName(java.lang.String name)
public void setEnabled(boolean enabled)
Operator
setEnabled in class Operatorpublic boolean isEnabled()
Operator
isEnabled in class Operatorpublic void experimentStarts()
Operator
experimentStarts in class Operatorpublic void experimentFinished()
Operator
experimentFinished in class Operator
public IOObject[] apply()
throws OperatorException
clearStepCounter().
apply in class OperatorOperatorException
public void performAdditionalChecks()
throws UserError
performAdditionalChecks in class OperatorUserErrorpublic int checkProperties()
checkProperties in class Operatorpublic int checkDeprecations()
Operator.getDeprecationInfo() method does not return null. Returns
the total number of deprecations.
checkDeprecations in class Operatorpublic int checkNumberOfInnerOperators()
protected java.lang.String createExperimentTree(int indent,
java.lang.String selfPrefix,
java.lang.String childPrefix,
Operator markOperator,
java.lang.String mark)
createExperimentTree in class Operatorprotected final java.lang.String getInnerOperatorsXML(java.lang.String indent)
Operator
getInnerOperatorsXML in class Operatorpublic void delete()
Operator
delete in class Operatorpublic void clearErrorList()
Operator
clearErrorList in class OperatorOperator.addError(String)public int getNumberOfChildrensSteps()
public void countStep()
public int getCurrentStep()
public void clearStepCounter()
Introduced because otherwise a overloading of apply(IOContainer) cannot reset the step counter.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||