Revision: 19158
http://sourceforge.net/p/gate/code/19158
Author: johann_p
Date: 2016-03-30 18:29:41 +0000 (Wed, 30 Mar 2016)
Log Message:
-----------
Only invoke the controller callbacks for PRs which are not
set to red / RUN_NEVER.
Modified Paths:
--------------
gate/trunk/src/main/gate/creole/ConditionalSerialAnalyserController.java
Modified:
gate/trunk/src/main/gate/creole/ConditionalSerialAnalyserController.java
===================================================================
--- gate/trunk/src/main/gate/creole/ConditionalSerialAnalyserController.java
2016-03-23 10:27:06 UTC (rev 19157)
+++ gate/trunk/src/main/gate/creole/ConditionalSerialAnalyserController.java
2016-03-30 18:29:41 UTC (rev 19158)
@@ -456,11 +456,17 @@
@Override
public void controllerExecutionStarted(Controller c)
throws ExecutionException {
- for(ControllerAwarePR pr : getControllerAwarePRs()) {
- if(pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser)pr).setCorpus(corpus);
- }
- pr.controllerExecutionStarted(this);
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionStarted(c);
+ }
+ }
}
}
@@ -468,29 +474,41 @@
@Override
public void controllerExecutionFinished(Controller c)
throws ExecutionException {
- for(ControllerAwarePR pr : getControllerAwarePRs()) {
- if(pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser)pr).setCorpus(corpus);
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionFinished(c);
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(null);
+ }
+ }
}
- pr.controllerExecutionFinished(this);
- if(pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser)pr).setCorpus(null);
- }
- }
+ }
}
@Override
public void controllerExecutionAborted(Controller c, Throwable t)
throws ExecutionException {
- for(ControllerAwarePR pr : getControllerAwarePRs()) {
- if(pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser)pr).setCorpus(corpus);
- }
- pr.controllerExecutionAborted(c, t);
- if(pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser)pr).setCorpus(null);
- }
- }
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionAborted(c,t);
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(null);
+ }
+ }
+ }
+ }
}
/**
@@ -502,15 +520,17 @@
*/
@Override
public void invokeControllerExecutionStarted() throws ExecutionException {
- for (ControllerAwarePR pr : getControllerAwarePRs()) {
- // If the pr is a nested corpus controller, make sure its corpus is set
- // This is necessary because the nested corpus controller will
immediately
- // notify its own controller aware PRs and those should be able to know
about
- // the corpus.
- if (pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser) pr).setCorpus(getCorpus());
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionStarted(this);
+ }
}
- pr.controllerExecutionStarted(this);
}
}
@@ -523,15 +543,22 @@
*/
@Override
public void invokeControllerExecutionFinished() throws ExecutionException {
- for (ControllerAwarePR pr : getControllerAwarePRs()) {
- if (pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser) pr).setCorpus(getCorpus());
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionFinished(this);
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(null);
+ }
+ }
}
- pr.controllerExecutionFinished(this);
- if (pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser) pr).setCorpus(null);
- }
- }
+ }
+
}
/**
@@ -544,15 +571,21 @@
*/
@Override
public void invokeControllerExecutionAborted(Throwable thrown) throws
ExecutionException {
- for (ControllerAwarePR pr : getControllerAwarePRs()) {
- if (pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser) pr).setCorpus(getCorpus());
+
+ for(int i=0; i<getPRs().size(); i++) {
+ ProcessingResource pr = getPRs().get(i);
+ if(pr instanceof ControllerAwarePR) {
+ if(getRunningStrategies().get(i).getRunMode() !=
RunningStrategy.RUN_NEVER) {
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(corpus);
+ }
+ ((ControllerAwarePR)pr).controllerExecutionAborted(this,thrown);
+ if(pr instanceof LanguageAnalyser) {
+ ((LanguageAnalyser)pr).setCorpus(null);
+ }
+ }
}
- pr.controllerExecutionAborted(this, thrown);
- if (pr instanceof LanguageAnalyser) {
- ((LanguageAnalyser) pr).setCorpus(null);
- }
- }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs