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