import java.util.List;
import org.wamblee.general.Pair;
-import org.wamblee.system.container.CompositeInterfaceRestriction;
-import org.wamblee.system.container.InterfaceRestriction;
import org.wamblee.system.core.Component;
import org.wamblee.system.core.ProvidedInterface;
import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.graph.CompositeEdgeFilter;
import org.wamblee.system.graph.DefaultEdge;
import org.wamblee.system.graph.Edge;
import org.wamblee.system.graph.Graph;
*/
public class ComponentGraph extends Graph {
- private CompositeInterfaceRestriction _restriction;
+ private CompositeEdgeFilter _edgeFilter;
/**
* 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);
+ _edgeFilter = new CompositeEdgeFilter();
}
/**
*/
public void validate() {
extend(new RequiredProvidedEdgeFactory());
- accept(new ApplyRestrictionsVisitor(this, _restriction));
+ applyFilter(_edgeFilter);
accept(new CheckRequiredProvidedMultiplicityVisitor(this));
accept(new CheckExternallyRequiredVisitor(this));
accept(new CheckExternallyProvidedVisitor(this));
* provided interfaces.
* @param aComponent Component to add.
*/
- public void addComponent(Component aComponent) {
+ public void addComponent(Component<?> aComponent) {
// Add required interfaces.
Node compNode = new ComponentNode(aComponent);
List<Node> requiredNodes = new ArrayList<Node>();
addEdge(new DefaultEdge(provNode, compNode));
}
}
+
+ public void addEdgeFilter(CompositeEdgeFilter aEdgeFilter) {
+ _edgeFilter.add(aEdgeFilter);
+ }
}