|
@@ 408-433 (lines=26) @@
|
| 405 |
|
* |
| 406 |
|
* @param dec |
| 407 |
|
*/ |
| 408 |
|
public synchronized void restore(Decision dec) |
| 409 |
|
{ |
| 410 |
|
// check decision component |
| 411 |
|
if (!dec.getComponent().equals(this)) { |
| 412 |
|
throw new RuntimeException("Trying to restore a not local decision on component:\n- component: " + this.name + "\n- decision: " + dec + "\n"); |
| 413 |
|
} |
| 414 |
|
|
| 415 |
|
// if active something goes wrong |
| 416 |
|
if (this.isActive(dec)) { |
| 417 |
|
// unexpected behavior |
| 418 |
|
throw new RuntimeException("Trying to restore an active decision:\n- decision: " + dec + "\n"); |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
// check if pending |
| 422 |
|
if (this.isPending(dec)) { |
| 423 |
|
// warning information |
| 424 |
|
warning("Trying to restore an already pending decision:\n- decision: " + dec + "\n"); |
| 425 |
|
// throw new RuntimeException("Trying to restore an already pending decision:\n- decision: " + dec + "\n"); |
| 426 |
|
} |
| 427 |
|
|
| 428 |
|
// check if silent decision |
| 429 |
|
if (this.isSilent(dec)) { |
| 430 |
|
// remove from silent set |
| 431 |
|
this.decisions.get(PlanElementStatus.SILENT).remove(dec); |
| 432 |
|
// add to pending set |
| 433 |
|
this.decisions.get(PlanElementStatus.PENDING).add(dec); |
| 434 |
|
} |
| 435 |
|
} |
| 436 |
|
|
|
@@ 779-803 (lines=25) @@
|
| 776 |
|
* |
| 777 |
|
* @param dec |
| 778 |
|
*/ |
| 779 |
|
public synchronized void free(Decision dec) |
| 780 |
|
{ |
| 781 |
|
// check decision component |
| 782 |
|
if (!dec.getComponent().equals(this)) { |
| 783 |
|
throw new RuntimeException("Trying to free a not local decision from a component:\n- component: " + this.name + "\n- decision: " + dec + "\n"); |
| 784 |
|
} |
| 785 |
|
|
| 786 |
|
// check if already SILENT |
| 787 |
|
if (this.isSilent(dec)) { |
| 788 |
|
// warning information |
| 789 |
|
warning("Trying to free an already SILENT decision:\n- decision: " + dec + "\n"); |
| 790 |
|
} |
| 791 |
|
|
| 792 |
|
// check if ACTIVE |
| 793 |
|
if (this.isActive(dec)) { |
| 794 |
|
// check as this could be a potential bug in the backtracking procedure when "restoring" plan states |
| 795 |
|
throw new RuntimeException("Trying to free an ACTIVE decision:\n- decision: " + dec + "\n"); |
| 796 |
|
} |
| 797 |
|
|
| 798 |
|
// complete transition PENDING -> SILENT |
| 799 |
|
if (this.isPending(dec)) { |
| 800 |
|
// delete pending decision |
| 801 |
|
this.decisions.get(PlanElementStatus.PENDING).remove(dec); |
| 802 |
|
// add to silent decisions |
| 803 |
|
this.decisions.get(PlanElementStatus.SILENT).add(dec); |
| 804 |
|
} |
| 805 |
|
} |
| 806 |
|
|