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 | |
---|
15 | package de.ugoe.cs.autoquest.tasktrees.temporalrelation; |
---|
16 | |
---|
17 | import java.util.ArrayList; |
---|
18 | import java.util.List; |
---|
19 | |
---|
20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; |
---|
22 | |
---|
23 | /** |
---|
24 | * <p> |
---|
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. |
---|
29 | * </p> |
---|
30 | * |
---|
31 | * @author Patrick Harms |
---|
32 | */ |
---|
33 | class RuleApplicationResult { |
---|
34 | |
---|
35 | /** */ |
---|
36 | private RuleApplicationStatus status = RuleApplicationStatus.NOT_APPLIED; |
---|
37 | |
---|
38 | /** */ |
---|
39 | private List<ITask> newParentTasks = new ArrayList<ITask>(); |
---|
40 | |
---|
41 | /** */ |
---|
42 | private List<ITaskInstance> newParentInstances = new ArrayList<ITaskInstance>(); |
---|
43 | |
---|
44 | /** |
---|
45 | * <p> |
---|
46 | * create a rule application result with a status {@link RuleApplicationStatus#RULE_NOT_APPLIED} |
---|
47 | * </p> |
---|
48 | */ |
---|
49 | RuleApplicationResult() { |
---|
50 | // this is the default indicating nothing so far |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * <p> |
---|
55 | * set the rule application status |
---|
56 | * </p> |
---|
57 | */ |
---|
58 | void setRuleApplicationStatus(RuleApplicationStatus status) { |
---|
59 | this.status = status; |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * <p> |
---|
64 | * return the rule application status |
---|
65 | * </p> |
---|
66 | */ |
---|
67 | RuleApplicationStatus getRuleApplicationStatus() { |
---|
68 | return status; |
---|
69 | } |
---|
70 | |
---|
71 | /** |
---|
72 | * <p> |
---|
73 | * add a further parent task created during the rule application |
---|
74 | * </p> |
---|
75 | */ |
---|
76 | void addNewlyCreatedTask(ITask newParent) { |
---|
77 | newParentTasks.add(newParent); |
---|
78 | } |
---|
79 | |
---|
80 | /** |
---|
81 | * <p> |
---|
82 | * return all parent tasks created during the rule application |
---|
83 | * </p> |
---|
84 | */ |
---|
85 | List<ITask> getNewlyCreatedTasks() { |
---|
86 | return newParentTasks; |
---|
87 | } |
---|
88 | |
---|
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 | |
---|
107 | } |
---|