This method can be used to check if a ProcessingResource has a chance to be run in the given controller with the current settings. That means that for a non-conditional controller, the method will return true if the PR is part of the controller. For a conditional controller, the method will retu
(Controller controller, ProcessingResource pr)
| 704 | * @return true or false depending on the conditions explained above. |
| 705 | */ |
| 706 | public static boolean isEnabled(Controller controller, ProcessingResource pr) { |
| 707 | Collection<ProcessingResource> prs = controller.getPRs(); |
| 708 | if(!prs.contains(pr)) { |
| 709 | return false; |
| 710 | } |
| 711 | if(controller instanceof ConditionalSerialController) { |
| 712 | Collection<RunningStrategy> rss = |
| 713 | ((ConditionalSerialController)controller).getRunningStrategies(); |
| 714 | for(RunningStrategy rs : rss) { |
| 715 | // if we find at least one occurrence of the PR that is not disabled |
| 716 | // return true |
| 717 | if(rs.getPR().equals(pr) && |
| 718 | rs.getRunMode() != RunningStrategy.RUN_NEVER) { |
| 719 | return true; |
| 720 | } |
| 721 | } |
| 722 | // if we get here, no occurrence of the PR has found or none that |
| 723 | // is not disabled, so return false |
| 724 | return false; |
| 725 | } |
| 726 | return true; |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * Return the running strategy of the PR in the controller, if the controller |
nothing calls this directly
no test coverage detected