Changeset 315:a34209857dcc
- Timestamp:
- 09/09/09 10:15:30 (4 years ago)
- Author:
- tgambet
- Branch:
- default
- convert_revision:
- svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@316
- Message:
-
added function isPassed that returns true is all the response are passed, false otherwise
+ observationList is generated only on first call of getObservationList()
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r302
|
r315
|
|
| 1 | | // $Id: UnicornCall.java,v 1.10 2009-09-08 14:24:22 tgambet Exp $ |
| | 1 | // $Id: UnicornCall.java,v 1.11 2009-09-09 10:15:30 tgambet Exp $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 82 | 82 | |
| 83 | 83 | private Map<String, String[]> mapOfStringParameter = null; |
| | 84 | |
| | 85 | private LinkedHashMap<String, Response> observationMap; |
| 84 | 86 | |
| 85 | 87 | /** |
| … |
… |
|
| 260 | 262 | public boolean getBPassed() { |
| 261 | 263 | return this.bPassed; |
| | 264 | } |
| | 265 | |
| | 266 | public boolean isPassed() { |
| | 267 | boolean passed = true; |
| | 268 | for (String key : this.getObservationList().keySet()) { |
| | 269 | if (!observationMap.get(key).isPassed()) { |
| | 270 | passed = false; |
| | 271 | } |
| | 272 | } |
| | 273 | return passed; |
| 262 | 274 | } |
| 263 | 275 | |
| … |
… |
|
| 589 | 601 | public LinkedHashMap<String, Response> getObservationList() { |
| 590 | 602 | |
| 591 | | LinkedHashMap<String, Response> observationMap = new LinkedHashMap<String, Response>(); |
| 592 | | |
| 593 | | for (Group group : aTask.getOutput().getGroupList()) { |
| 594 | | if (!group.isSetType()) { |
| 595 | | for (String observerId : group.getObservationList()) { |
| 596 | | if(mapOfResponse.get(observerId) != null) { |
| 597 | | observationMap.put(observerId, mapOfResponse.get(observerId)); |
| | 603 | if (observationMap == null) { |
| | 604 | observationMap = new LinkedHashMap<String, Response>(); |
| | 605 | |
| | 606 | for (Group group : aTask.getOutput().getGroupList()) { |
| | 607 | if (!group.isSetType()) { |
| | 608 | for (String observerId : group.getObservationList()) { |
| | 609 | if(mapOfResponse.get(observerId) != null) { |
| | 610 | observationMap.put(observerId, mapOfResponse.get(observerId)); |
| | 611 | } |
| | 612 | } |
| | 613 | } else { |
| | 614 | switch (group.getType()) { |
| | 615 | case FIRSTPASSED: |
| | 616 | String passedId = null; |
| | 617 | for (String observerId : group.getObservationList()) { |
| | 618 | if (mapOfResponse.get(observerId) == null) { |
| | 619 | logger.error("unknown observer id (" + observerId + ") in output group of task: " + this.getTask().getID()); |
| | 620 | continue; |
| | 621 | } |
| | 622 | if (mapOfResponse.get(observerId).isPassed()) { |
| | 623 | passedId = observerId; |
| | 624 | break; |
| | 625 | } |
| | 626 | } |
| | 627 | if (passedId == null) { |
| | 628 | Response resp = mapOfResponse.get(group.getObservationList().get(0)); |
| | 629 | if (resp != null) |
| | 630 | observationMap.put(group.getObservationList().get(0), resp); |
| | 631 | } |
| | 632 | else |
| | 633 | observationMap.put(passedId, mapOfResponse.get(passedId)); |
| 598 | 634 | } |
| 599 | 635 | } |
| 600 | | } else { |
| 601 | | switch (group.getType()) { |
| 602 | | case FIRSTPASSED: |
| 603 | | String passedId = null; |
| 604 | | for (String observerId : group.getObservationList()) { |
| 605 | | if (mapOfResponse.get(observerId) == null) { |
| 606 | | logger.error("unknown observer id (" + observerId + ") in output group of task: " + this.getTask().getID()); |
| 607 | | continue; |
| 608 | | } |
| 609 | | if (mapOfResponse.get(observerId).isPassed()) { |
| 610 | | passedId = observerId; |
| 611 | | break; |
| 612 | | } |
| 613 | | } |
| 614 | | if (passedId == null) { |
| 615 | | Response resp = mapOfResponse.get(group.getObservationList().get(0)); |
| 616 | | if (resp != null) |
| 617 | | observationMap.put(group.getObservationList().get(0), resp); |
| 618 | | } |
| 619 | | else |
| 620 | | observationMap.put(passedId, mapOfResponse.get(passedId)); |
| 621 | | } |
| 622 | | } |
| 623 | | } |
| | 636 | } |
| | 637 | } |
| | 638 | |
| 624 | 639 | return observationMap; |
| 625 | 640 | } |