(no commit message)
[utils] / system / general / src / main / java / org / wamblee / system / graph / component / ComponentGraph.java
index 20313b5983785b82d8b9d033a929a6fb3942e64f..15f86557ab2a55dccdec85b2d8604d6b3bfcc07a 100644 (file)
@@ -33,26 +33,53 @@ import org.wamblee.system.graph.Node;
 // TODO info superfluous required interfaces
 // TODO check optional external required but mandatory internal.  
 
+/**
+ * Represents a component graph and provides the bridge from the 
+ * component model to a graph model. The graph model is easier
+ * to work with to implement specific actions and validations than 
+ * the component model. 
+ */
 public class ComponentGraph extends Graph {
     
     private CompositeInterfaceRestriction _restriction; 
 
+    /**
+     * Constructs an empty component graph. 
+     */
     public ComponentGraph() { 
         _restriction = new CompositeInterfaceRestriction(); 
     }
     
+    /**
+     * Adds a restriction that must be satisfied by the component model. 
+     * @param aRestriction Restriction. 
+     */
     public void addRestriction(InterfaceRestriction aRestriction) { 
         _restriction.add(aRestriction);
     }
     
+    /**
+     * Adds an externally required interface of a container.  
+     * This should be called before any components of the container are
+     * added. 
+     * @param aInterface Required interface. 
+     */
     public void addRequiredInterface(RequiredInterface aInterface) { 
         addNode(new ExternalRequiredInterfaceNode(aInterface));
     }
     
+    /**
+     * Adds an externally provided interface of a container.
+     * This should be called after all components of the container have been added.  
+     * @param aInterface Provided interface. 
+     */
     public void addProvidedInterface(ProvidedInterface aInterface) { 
         addNode(new ExternalProvidedInterfaceNode(aInterface));
     }
     
+    /**
+     * Validates the component graph. 
+     */
     public void validate() { 
         extend(new RequiredProvidedEdgeFactory());
         accept(new ApplyRestrictionsVisitor(this, _restriction));
@@ -62,6 +89,10 @@ public class ComponentGraph extends Graph {
         accept(new CheckStartupDependenciesVisitor(this));
     }
     
+    /**
+     * Links provided and required interfaces together in the component
+     * model based on the graph model. 
+     */
     public void link() { 
         accept(new LinkVisitor());
     }
@@ -86,6 +117,11 @@ public class ComponentGraph extends Graph {
         return result; 
     }
     
+    /**
+     * Adds a component by adding required interfaces, components, and
+     * provided interfaces. 
+     * @param aComponent Component to add. 
+     */
     public void addComponent(Component aComponent) { 
         // Add required interfaces. 
         Node compNode = new ComponentNode(aComponent);