Changeset 1733 for branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/ComponentManager.java
- Timestamp:
- 09/05/14 19:33:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/ComponentManager.java
r1189 r1733 23 23 /** 24 24 * <p> 25 * The component manager is the central reference for the distinct submodules required for 26 * task tree generation. Such include the temporal relationship rule manager, the task equality 27 * rule manager, the default task builder, as well as the default task factory. 25 * The component manager is the central reference for the distinct submodules 26 * required for task tree generation. Such include the temporal relationship 27 * rule manager, the task equality rule manager, the default task builder, as 28 * well as the default task factory. 28 29 * </p> 29 30 * … … 32 33 */ 33 34 public class ComponentManager { 34 35 /**36 * <p>37 * singleton instance of this class38 * </p>39 */40 private static ComponentManager instance;41 35 42 /** 43 * <p> 44 * the default temporal relationship rule manager 45 * </p> 46 */ 47 private TemporalRelationshipRuleManager temporalRelationshipRuleManager; 36 /** 37 * <p> 38 * clears the singleton instance. Needed for test purposes to ensure 39 * statelessness between tests. 40 * </p> 41 */ 42 public static synchronized void clearInstance() { 43 instance = null; 44 } 48 45 49 /** 50 * <p> 51 * the default task builder 52 * </p> 53 */ 54 private ITaskBuilder taskBuilder; 46 /** 47 * <p> 48 * returns the default task builder 49 * </p> 50 * 51 * @return as described 52 */ 53 public static ITaskBuilder getDefaultTaskBuilder() { 54 return getInstance().taskBuilder; 55 } 55 56 56 /** 57 * <p> 58 * the default task factory 59 * </p> 60 */ 61 private ITaskFactory taskFactory; 57 /** 58 * <p> 59 * returns the default task factory 60 * </p> 61 * 62 * @return as described 63 */ 64 public static ITaskFactory getDefaultTaskFactory() { 65 return getInstance().taskFactory; 66 } 62 67 63 /** 64 * <p> 65 * returns the default temporal relationship rule manager 66 * </p> 67 * 68 * @return as described 69 */ 70 public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() { 71 return getInstance().temporalRelationshipRuleManager; 72 } 68 /** 69 * <p> 70 * returns the singleton instance of this class 71 * </p> 72 * 73 * @return as described 74 */ 75 private static synchronized ComponentManager getInstance() { 76 if (instance == null) { 77 instance = new ComponentManager(); 78 instance.init(); 79 } 80 return instance; 81 } 73 82 74 75 76 * returns the default task builder77 78 79 80 81 public static ITaskBuilder getDefaultTaskBuilder() {82 return getInstance().taskBuilder;83 83 /** 84 * <p> 85 * returns the default temporal relationship rule manager 86 * </p> 87 * 88 * @return as described 89 */ 90 public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() { 91 return getInstance().temporalRelationshipRuleManager; 92 } 84 93 85 /** 86 * <p> 87 * returns the default task factory 88 * </p> 89 * 90 * @return as described 91 */ 92 public static ITaskFactory getDefaultTaskFactory() { 93 return getInstance().taskFactory; 94 } 94 /** 95 * <p> 96 * singleton instance of this class 97 * </p> 98 */ 99 private static ComponentManager instance; 95 100 96 /** 97 * <p> 98 * clears the singleton instance. Needed for test purposes to ensure statelessness between 99 * tests. 100 * </p> 101 */ 102 public static synchronized void clearInstance() { 103 instance = null; 104 } 101 /** 102 * <p> 103 * the default temporal relationship rule manager 104 * </p> 105 */ 106 private TemporalRelationshipRuleManager temporalRelationshipRuleManager; 105 107 106 /** 107 * <p> 108 * returns the singleton instance of this class 109 * </p> 110 * 111 * @return as described 112 */ 113 private static synchronized ComponentManager getInstance() { 114 if (instance == null) { 115 instance = new ComponentManager(); 116 instance.init(); 117 } 118 return instance; 119 } 108 /** 109 * <p> 110 * the default task builder 111 * </p> 112 */ 113 private ITaskBuilder taskBuilder; 120 114 121 /** 122 * <p> 123 * initialized the component manager with all it default components which are the temporal 124 * relationship rule manager, the task equality rule manager, the default task builder, as 125 * well as the default task factory. 126 * </p> 127 */ 128 private void init() { 129 taskBuilder = new TaskBuilder(); 130 taskFactory = new TaskFactory(); 115 /** 116 * <p> 117 * the default task factory 118 * </p> 119 */ 120 private ITaskFactory taskFactory; 131 121 132 temporalRelationshipRuleManager = 133 new TemporalRelationshipRuleManager(taskFactory, taskBuilder); 134 temporalRelationshipRuleManager.init(); 135 } 122 /** 123 * <p> 124 * initialized the component manager with all it default components which 125 * are the temporal relationship rule manager, the task equality rule 126 * manager, the default task builder, as well as the default task factory. 127 * </p> 128 */ 129 private void init() { 130 taskBuilder = new TaskBuilder(); 131 taskFactory = new TaskFactory(); 132 133 temporalRelationshipRuleManager = new TemporalRelationshipRuleManager( 134 taskFactory, taskBuilder); 135 temporalRelationshipRuleManager.init(); 136 } 136 137 137 138 }
Note: See TracChangeset
for help on using the changeset viewer.