[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 | |
---|
[922] | 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; |
---|
[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 | /** */ |
---|
| 39 | private NodeEqualityRuleManager nodeEqualityRuleManager; |
---|
[439] | 40 | |
---|
[557] | 41 | /** */ |
---|
| 42 | private ITaskTreeBuilder taskTreeBuilder; |
---|
[439] | 43 | |
---|
[557] | 44 | /** */ |
---|
| 45 | private ITaskTreeNodeFactory taskTreeNodeFactory; |
---|
[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 | */ |
---|
| 57 | public static NodeEqualityRuleManager getNodeEqualityRuleManager() { |
---|
| 58 | return getInstance().nodeEqualityRuleManager; |
---|
| 59 | } |
---|
[439] | 60 | |
---|
[557] | 61 | /** |
---|
[1099] | 62 | * |
---|
[557] | 63 | */ |
---|
| 64 | public static ITaskTreeBuilder getDefaultTaskTreeBuilder() { |
---|
| 65 | return getInstance().taskTreeBuilder; |
---|
| 66 | } |
---|
[439] | 67 | |
---|
[557] | 68 | /** |
---|
[1099] | 69 | * |
---|
[557] | 70 | */ |
---|
| 71 | public static ITaskTreeNodeFactory getDefaultTaskTreeNodeFactory() { |
---|
| 72 | return getInstance().taskTreeNodeFactory; |
---|
| 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() { |
---|
| 97 | nodeEqualityRuleManager = new NodeEqualityRuleManager(); |
---|
| 98 | nodeEqualityRuleManager.init(); |
---|
[439] | 99 | |
---|
[557] | 100 | taskTreeBuilder = new TaskTreeBuilder(); |
---|
| 101 | taskTreeNodeFactory = new TaskTreeNodeFactory(); |
---|
[1109] | 102 | |
---|
| 103 | temporalRelationshipRuleManager = new TemporalRelationshipRuleManager |
---|
| 104 | (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder); |
---|
| 105 | temporalRelationshipRuleManager.init(); |
---|
[557] | 106 | } |
---|
| 107 | |
---|
[439] | 108 | } |
---|