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.manager; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; |
---|
18 | import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TemporalRelationshipRuleManager; |
---|
19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; |
---|
20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; |
---|
21 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; |
---|
22 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; |
---|
23 | |
---|
24 | /** |
---|
25 | * TODO comment |
---|
26 | * |
---|
27 | * @version $Revision: $ $Date: 12.02.2012$ |
---|
28 | * @author 2012, last modified by $Author: patrick$ |
---|
29 | */ |
---|
30 | public class ComponentManager { |
---|
31 | |
---|
32 | /** */ |
---|
33 | private static ComponentManager instance; |
---|
34 | |
---|
35 | /** */ |
---|
36 | private TemporalRelationshipRuleManager temporalRelationshipRuleManager; |
---|
37 | |
---|
38 | /** */ |
---|
39 | private NodeEqualityRuleManager nodeEqualityRuleManager; |
---|
40 | |
---|
41 | /** */ |
---|
42 | private ITaskTreeBuilder taskTreeBuilder; |
---|
43 | |
---|
44 | /** */ |
---|
45 | private ITaskTreeNodeFactory taskTreeNodeFactory; |
---|
46 | |
---|
47 | /** |
---|
48 | * |
---|
49 | */ |
---|
50 | public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() { |
---|
51 | return getInstance().temporalRelationshipRuleManager; |
---|
52 | } |
---|
53 | |
---|
54 | /** |
---|
55 | * |
---|
56 | */ |
---|
57 | public static NodeEqualityRuleManager getNodeEqualityRuleManager() { |
---|
58 | return getInstance().nodeEqualityRuleManager; |
---|
59 | } |
---|
60 | |
---|
61 | /** |
---|
62 | * |
---|
63 | */ |
---|
64 | public static ITaskTreeBuilder getDefaultTaskTreeBuilder() { |
---|
65 | return getInstance().taskTreeBuilder; |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * |
---|
70 | */ |
---|
71 | public static ITaskTreeNodeFactory getDefaultTaskTreeNodeFactory() { |
---|
72 | return getInstance().taskTreeNodeFactory; |
---|
73 | } |
---|
74 | |
---|
75 | /** |
---|
76 | * |
---|
77 | */ |
---|
78 | public static synchronized void clearInstance() { |
---|
79 | instance = null; |
---|
80 | } |
---|
81 | |
---|
82 | /** |
---|
83 | * |
---|
84 | */ |
---|
85 | private static synchronized ComponentManager getInstance() { |
---|
86 | if (instance == null) { |
---|
87 | instance = new ComponentManager(); |
---|
88 | instance.init(); |
---|
89 | } |
---|
90 | return instance; |
---|
91 | } |
---|
92 | |
---|
93 | /** |
---|
94 | * |
---|
95 | */ |
---|
96 | private void init() { |
---|
97 | nodeEqualityRuleManager = new NodeEqualityRuleManager(); |
---|
98 | nodeEqualityRuleManager.init(); |
---|
99 | |
---|
100 | taskTreeBuilder = new TaskTreeBuilder(); |
---|
101 | taskTreeNodeFactory = new TaskTreeNodeFactory(); |
---|
102 | |
---|
103 | temporalRelationshipRuleManager = new TemporalRelationshipRuleManager |
---|
104 | (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder); |
---|
105 | temporalRelationshipRuleManager.init(); |
---|
106 | } |
---|
107 | |
---|
108 | } |
---|