[1113] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.temporalrelation; |
---|
[439] | 16 | |
---|
| 17 | import java.util.ArrayList; |
---|
| 18 | import java.util.List; |
---|
| 19 | |
---|
[1146] | 20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
| 21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; |
---|
[439] | 22 | |
---|
| 23 | /** |
---|
[809] | 24 | * <p> |
---|
[1146] | 25 | * The rule application result describes the result of applying a {@link ITemporalRelationshipRule}. |
---|
| 26 | * It contains a {@link RuleApplicationStatus} and a list of all parent task instances and tasks |
---|
| 27 | * that were created during a rule application. See the description of |
---|
| 28 | * {@link ITemporalRelationshipRule} for more details. |
---|
[809] | 29 | * </p> |
---|
[439] | 30 | * |
---|
[809] | 31 | * @author Patrick Harms |
---|
[439] | 32 | */ |
---|
[809] | 33 | class RuleApplicationResult { |
---|
[439] | 34 | |
---|
[557] | 35 | /** */ |
---|
[1127] | 36 | private RuleApplicationStatus status = RuleApplicationStatus.NOT_APPLIED; |
---|
[439] | 37 | |
---|
[557] | 38 | /** */ |
---|
[1146] | 39 | private List<ITask> newParentTasks = new ArrayList<ITask>(); |
---|
[439] | 40 | |
---|
[1146] | 41 | /** */ |
---|
| 42 | private List<ITaskInstance> newParentInstances = new ArrayList<ITaskInstance>(); |
---|
| 43 | |
---|
[557] | 44 | /** |
---|
[809] | 45 | * <p> |
---|
| 46 | * create a rule application result with a status {@link RuleApplicationStatus#RULE_NOT_APPLIED} |
---|
| 47 | * </p> |
---|
[557] | 48 | */ |
---|
[809] | 49 | RuleApplicationResult() { |
---|
[557] | 50 | // this is the default indicating nothing so far |
---|
| 51 | } |
---|
[439] | 52 | |
---|
[557] | 53 | /** |
---|
[809] | 54 | * <p> |
---|
| 55 | * set the rule application status |
---|
| 56 | * </p> |
---|
[557] | 57 | */ |
---|
[809] | 58 | void setRuleApplicationStatus(RuleApplicationStatus status) { |
---|
[557] | 59 | this.status = status; |
---|
| 60 | } |
---|
[439] | 61 | |
---|
[557] | 62 | /** |
---|
[809] | 63 | * <p> |
---|
| 64 | * return the rule application status |
---|
| 65 | * </p> |
---|
[557] | 66 | */ |
---|
[809] | 67 | RuleApplicationStatus getRuleApplicationStatus() { |
---|
[557] | 68 | return status; |
---|
| 69 | } |
---|
[439] | 70 | |
---|
[557] | 71 | /** |
---|
[809] | 72 | * <p> |
---|
[1146] | 73 | * add a further parent task created during the rule application |
---|
[809] | 74 | * </p> |
---|
[557] | 75 | */ |
---|
[1146] | 76 | void addNewlyCreatedTask(ITask newParent) { |
---|
| 77 | newParentTasks.add(newParent); |
---|
[557] | 78 | } |
---|
[439] | 79 | |
---|
[557] | 80 | /** |
---|
[809] | 81 | * <p> |
---|
[1146] | 82 | * return all parent tasks created during the rule application |
---|
[809] | 83 | * </p> |
---|
[557] | 84 | */ |
---|
[1146] | 85 | List<ITask> getNewlyCreatedTasks() { |
---|
| 86 | return newParentTasks; |
---|
[557] | 87 | } |
---|
| 88 | |
---|
[1146] | 89 | /** |
---|
| 90 | * <p> |
---|
| 91 | * add a further parent task instance created during the rule application |
---|
| 92 | * </p> |
---|
| 93 | */ |
---|
| 94 | void addNewlyCreatedTaskInstance(ITaskInstance newParent) { |
---|
| 95 | newParentInstances.add(newParent); |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * <p> |
---|
| 100 | * return all parent task instances created during the rule application |
---|
| 101 | * </p> |
---|
| 102 | */ |
---|
| 103 | List<ITaskInstance> getNewlyCreatedTaskInstances() { |
---|
| 104 | return newParentInstances; |
---|
| 105 | } |
---|
| 106 | |
---|
[439] | 107 | } |
---|