source: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/ComponentManager.java @ 1734

Last change on this file since 1734 was 1734, checked in by rkrimmel, 10 years ago

Added automatically created javadoc, still needs to be commented properly though

  • Property svn:executable set to *
File size: 3.3 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.tasktrees.manager;
16
17import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TemporalRelationshipRuleManager;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
19import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory;
20import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder;
21import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory;
22
23// TODO: Auto-generated Javadoc
24/**
25 * <p>
26 * The component manager is the central reference for the distinct submodules
27 * required for task tree generation. Such include the temporal relationship
28 * rule manager, the task equality rule manager, the default task builder, as
29 * well as the default task factory.
30 * </p>
31 *
32 * @author pharms
33 * @version 1.0
34 */
35public class ComponentManager {
36
37        /**
38         * <p>
39         * clears the singleton instance. Needed for test purposes to ensure
40         * statelessness between tests.
41         * </p>
42         */
43        public static synchronized void clearInstance() {
44                instance = null;
45        }
46
47        /**
48         * <p>
49         * returns the default task builder
50         * </p>.
51         *
52         * @return as described
53         */
54        public static ITaskBuilder getDefaultTaskBuilder() {
55                return getInstance().taskBuilder;
56        }
57
58        /**
59         * <p>
60         * returns the default task factory
61         * </p>.
62         *
63         * @return as described
64         */
65        public static ITaskFactory getDefaultTaskFactory() {
66                return getInstance().taskFactory;
67        }
68
69        /**
70         * <p>
71         * returns the singleton instance of this class
72         * </p>.
73         *
74         * @return as described
75         */
76        private static synchronized ComponentManager getInstance() {
77                if (instance == null) {
78                        instance = new ComponentManager();
79                        instance.init();
80                }
81                return instance;
82        }
83
84        /**
85         * <p>
86         * returns the default temporal relationship rule manager
87         * </p>.
88         *
89         * @return as described
90         */
91        public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() {
92                return getInstance().temporalRelationshipRuleManager;
93        }
94
95        /** <p> singleton instance of this class </p>. */
96        private static ComponentManager instance;
97
98        /** <p> the default temporal relationship rule manager </p>. */
99        private TemporalRelationshipRuleManager temporalRelationshipRuleManager;
100
101        /** <p> the default task builder </p>. */
102        private ITaskBuilder taskBuilder;
103
104        /** <p> the default task factory </p>. */
105        private ITaskFactory taskFactory;
106
107        /**
108         * <p>
109         * initialized the component manager with all it default components which
110         * are the temporal relationship rule manager, the task equality rule
111         * manager, the default task builder, as well as the default task factory.
112         * </p>
113         */
114        private void init() {
115                taskBuilder = new TaskBuilder();
116                taskFactory = new TaskFactory();
117
118                temporalRelationshipRuleManager = new TemporalRelationshipRuleManager(
119                                taskFactory, taskBuilder);
120                temporalRelationshipRuleManager.init();
121        }
122
123}
Note: See TracBrowser for help on using the repository browser.