| @@ 576-627 (lines=52) @@ | ||
| 573 | // get task description |
|
| 574 | AgentTaskDescription task = goal.getTaskDescription(); |
|
| 575 | // set known information concerning components |
|
| 576 | for (TokenDescription f : task.getFacts()) |
|
| 577 | { |
|
| 578 | // get domain component |
|
| 579 | DomainComponent component = this.pdb.getComponentByName(f.getComponent()); |
|
| 580 | // get goal referred value |
|
| 581 | ComponentValue value = component.getValueByName(f.getValue()); |
|
| 582 | // check start time bound |
|
| 583 | long[] start = f.getStart(); |
|
| 584 | if (start == null) { |
|
| 585 | start = new long[] { |
|
| 586 | this.pdb.getOrigin(), |
|
| 587 | this.pdb.getHorizon() |
|
| 588 | }; |
|
| 589 | } |
|
| 590 | ||
| 591 | // check end time bound |
|
| 592 | long[] end = f.getEnd(); |
|
| 593 | if (end == null) { |
|
| 594 | end = new long[] { |
|
| 595 | this.pdb.getOrigin(), |
|
| 596 | this.pdb.getHorizon() |
|
| 597 | }; |
|
| 598 | } |
|
| 599 | ||
| 600 | // check duration bound |
|
| 601 | long[] duration = f.getDuration(); |
|
| 602 | if (duration == null) { |
|
| 603 | duration = new long[] { |
|
| 604 | value.getDurationLowerBound(), |
|
| 605 | value.getDurationUpperBound() |
|
| 606 | }; |
|
| 607 | } |
|
| 608 | ||
| 609 | // check labels |
|
| 610 | String[] labels = f.getLabels(); |
|
| 611 | if (labels == null) { |
|
| 612 | labels = new String[] {}; |
|
| 613 | } |
|
| 614 | ||
| 615 | // create fact decision |
|
| 616 | Decision decision = component.create( |
|
| 617 | value, |
|
| 618 | labels, |
|
| 619 | start, |
|
| 620 | end, |
|
| 621 | duration |
|
| 622 | ); |
|
| 623 | ||
| 624 | // also activate fact decision |
|
| 625 | component.activate(decision); |
|
| 626 | // add decision to fact list |
|
| 627 | facts.add(decision); |
|
| 628 | } |
|
| 629 | ||
| 630 | // set planning goals |
|
| @@ 631-680 (lines=50) @@ | ||
| 628 | } |
|
| 629 | ||
| 630 | // set planning goals |
|
| 631 | for (TokenDescription g : task.getGoals()) |
|
| 632 | { |
|
| 633 | // get domain component |
|
| 634 | DomainComponent component = this.pdb.getComponentByName(g.getComponent()); |
|
| 635 | // get goal referred value |
|
| 636 | ComponentValue value = component.getValueByName(g.getValue()); |
|
| 637 | // check start time bound |
|
| 638 | long[] start = g.getStart(); |
|
| 639 | if (start == null) { |
|
| 640 | start = new long[] { |
|
| 641 | this.pdb.getOrigin(), |
|
| 642 | this.pdb.getHorizon() |
|
| 643 | }; |
|
| 644 | } |
|
| 645 | ||
| 646 | // check end time bound |
|
| 647 | long[] end = g.getEnd(); |
|
| 648 | if (end == null) { |
|
| 649 | end = new long[] { |
|
| 650 | this.pdb.getOrigin(), |
|
| 651 | this.pdb.getHorizon() |
|
| 652 | }; |
|
| 653 | } |
|
| 654 | ||
| 655 | // check duration bound |
|
| 656 | long[] duration = g.getDuration(); |
|
| 657 | if (duration == null) { |
|
| 658 | duration = new long[] { |
|
| 659 | value.getDurationLowerBound(), |
|
| 660 | value.getDurationUpperBound() |
|
| 661 | }; |
|
| 662 | } |
|
| 663 | ||
| 664 | // check labels |
|
| 665 | String[] labels = g.getLabels(); |
|
| 666 | if (labels == null) { |
|
| 667 | labels = new String[] {}; |
|
| 668 | } |
|
| 669 | ||
| 670 | // create goal decision |
|
| 671 | Decision decision = component.create( |
|
| 672 | value, |
|
| 673 | labels, |
|
| 674 | start, |
|
| 675 | end, |
|
| 676 | duration |
|
| 677 | ); |
|
| 678 | ||
| 679 | // add decision to goal list |
|
| 680 | goals.add(decision); |
|
| 681 | } |
|
| 682 | ||
| 683 | ||