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.treeimpl; |
---|
16 | |
---|
17 | import java.util.List; |
---|
18 | |
---|
19 | import de.ugoe.cs.autoquest.eventcore.IEventTarget; |
---|
20 | import de.ugoe.cs.autoquest.eventcore.IEventType; |
---|
21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; |
---|
22 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; |
---|
23 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; |
---|
24 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; |
---|
25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; |
---|
26 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
27 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; |
---|
28 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; |
---|
29 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; |
---|
30 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; |
---|
31 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; |
---|
32 | |
---|
33 | /** |
---|
34 | * <p> |
---|
35 | * this is the default implementation of the interface {@link ITaskFactory}. It |
---|
36 | * does not do anything fancy except implementing the interface. It instantiates the other |
---|
37 | * implementations of the tree ifc in this package. |
---|
38 | * </p> |
---|
39 | * |
---|
40 | * @author Patrick Harms |
---|
41 | */ |
---|
42 | public class TaskFactory implements ITaskFactory { |
---|
43 | |
---|
44 | /* (non-Javadoc) |
---|
45 | * @see ITaskFactory#createNewEventTask(IEventType, IEventTarget) |
---|
46 | */ |
---|
47 | @Override |
---|
48 | public IEventTask createNewEventTask(IEventType eventType, IEventTarget eventTarget) { |
---|
49 | return new EventTask(eventType, eventTarget); |
---|
50 | } |
---|
51 | |
---|
52 | /* (non-Javadoc) |
---|
53 | * @see ITaskFactory#createNewSequence() |
---|
54 | */ |
---|
55 | @Override |
---|
56 | public ISequence createNewSequence() { |
---|
57 | return new Sequence(); |
---|
58 | } |
---|
59 | |
---|
60 | /* (non-Javadoc) |
---|
61 | * @see ITaskFactory#createNewIteration() |
---|
62 | */ |
---|
63 | @Override |
---|
64 | public IIteration createNewIteration() { |
---|
65 | return new Iteration(); |
---|
66 | } |
---|
67 | |
---|
68 | /* (non-Javadoc) |
---|
69 | * @see ITaskFactory#createNewOptional() |
---|
70 | */ |
---|
71 | @Override |
---|
72 | public IOptional createNewOptional() { |
---|
73 | return new Optional(); |
---|
74 | } |
---|
75 | |
---|
76 | /* (non-Javadoc) |
---|
77 | * @see ITaskFactory#createNewSelection() |
---|
78 | */ |
---|
79 | @Override |
---|
80 | public ISelection createNewSelection() { |
---|
81 | return new Selection(); |
---|
82 | } |
---|
83 | |
---|
84 | /* (non-Javadoc) |
---|
85 | * @see ITaskFactory#createNewTaskInstance(ITask) |
---|
86 | */ |
---|
87 | @Override |
---|
88 | public ITaskInstance createNewTaskInstance(ITask task) { |
---|
89 | return new TaskInstance(task); |
---|
90 | } |
---|
91 | |
---|
92 | /* (non-Javadoc) |
---|
93 | * @see ITaskFactory#createNewTaskInstanceList() |
---|
94 | */ |
---|
95 | @Override |
---|
96 | public ITaskInstanceList createNewTaskInstanceList() { |
---|
97 | return new TaskInstance(new Sequence()); |
---|
98 | } |
---|
99 | |
---|
100 | /* (non-Javadoc) |
---|
101 | * @see ITaskFactory#createUserSession() |
---|
102 | */ |
---|
103 | @Override |
---|
104 | public IUserSession createUserSession() { |
---|
105 | return new UserSession(); |
---|
106 | } |
---|
107 | |
---|
108 | /* (non-Javadoc) |
---|
109 | * @see ITaskFactory#createTaskModel(List<IUserSession>) |
---|
110 | */ |
---|
111 | @Override |
---|
112 | public ITaskModel createTaskModel(List<IUserSession> userSessions) { |
---|
113 | return new TaskModel(userSessions); |
---|
114 | } |
---|
115 | |
---|
116 | } |
---|