source: trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/testutil/TaskTreeBuilder.java @ 1141

Last change on this file since 1141 was 1040, checked in by adeicke, 11 years ago
  • Removed lombok related annotations and util class
  • Added comments and formating due to match project defaults
  • Property svn:mime-type set to text/plain
File size: 3.2 KB
Line 
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
15package de.ugoe.cs.autoquest.usability.testutil;
16
17import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
19import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode;
20import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory;
21
22/**
23 * <p>
24 * TODO comment
25 * </p>
26 *
27 * @author Alexander Deicke
28 */
29public class TaskTreeBuilder {
30
31    public static CreateRootNodeStep builder() {
32        return new CreateRootNodeStep();
33    }
34
35    public static class CreateRootNodeStep {
36
37        public AddChildrenStep root(String name) {
38            return new AddChildrenStep(new TaskTreeNode(name));
39        }
40
41    }
42
43    public static class AddChildrenStep {
44
45        private TaskTreeNode rootNode;
46
47        public AddChildrenStep(TaskTreeNode taskTreeRootNode) {
48            this.rootNode = taskTreeRootNode;
49        }
50
51        public AddChildrenStep addChild(ITaskTreeNode childNode) {
52            this.rootNode.getChildren().add(childNode);
53            return this;
54        }
55
56        public ITaskTree creatTaskTree() {
57            return new TaskTreeNodeFactory().createTaskTree(rootNode);
58        }
59
60    }
61
62    // private Employee employee;
63    //
64    // public EmployeeBuilder() {
65    // employee = new Employee();
66    // }
67    //
68    // public static EmployeeBuilder defaultValues() {
69    // return new EmployeeBuilder();
70    // }
71    //
72    // public static EmployeeBuilder clone(Employee toClone) {
73    // EmployeeBuilder builder = defaultValues();
74    // builder.setId(toClone.getId());
75    // builder.setName(toClone.getName());
76    // builder.setDepartment(toClone.getDepartment());
77    // return builder;
78    // }
79    //
80    // public static EmployeeBuilder random() {
81    // EmployeeBuilder builder = defaultValues();
82    // builder.setId(getRandomInteger(0, 1000));
83    // builder.setName(getRandomString(20));
84    // builder.setDepartment(Department.values()[getRandomInteger(0, Department.values().length -
85    // 1)]);
86    // return builder;
87    // }
88    //
89    // public EmployeeBuilder setId(int id) {
90    // employee.setId(id);
91    // return this;
92    // }
93    //
94    // public EmployeeBuilder setName(String name) {
95    // employee.setName(name);
96    // return this;
97    // }
98    //
99    // public EmployeeBuilder setDepartment(Department dept) {
100    // employee.setDepartment(dept);
101    // return this;
102    // }
103    //
104    // public Employee build() {
105    // return employee;
106    // }
107    // }
108
109}
Note: See TracBrowser for help on using the repository browser.