/*
- * Copyright 2008 the original author or authors.
+ * Copyright 2005-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.system.graph.component;
import org.wamblee.system.graph.Edge;
* container.
*
* @author Erik Brakkee
- *
*/
public class ConnectExternalProvidedProvidedFilter implements EdgeFilter {
+ private String externalProvided;
+
+ private String component;
- private String _externalProvided;
- private String _component;
- private String _provided;
+ private String provided;
- public ConnectExternalProvidedProvidedFilter(String aExternalProvided, String aComponent,
- String aProvided) {
- _externalProvided = aExternalProvided;
- _component = aComponent;
- _provided = aProvided;
- if ( _externalProvided == null ) {
- throw new IllegalArgumentException("External provided interface name must be specified.");
+ /**
+ * Creates a new ConnectExternalProvidedProvidedFilter object.
+ *
+ */
+ public ConnectExternalProvidedProvidedFilter(String aExternalProvided,
+ String aComponent, String aProvided) {
+ externalProvided = aExternalProvided;
+ component = aComponent;
+ provided = aProvided;
+
+ if (externalProvided == null) {
+ throw new IllegalArgumentException(
+ "External provided interface name must be specified.");
}
- if ( _component == null ) {
- throw new IllegalArgumentException("Component name must be specified");
+
+ if (component == null) {
+ throw new IllegalArgumentException(
+ "Component name must be specified");
}
- if ( _provided == null ) {
- throw new IllegalArgumentException("Provided interface name of internal component must be specified");
+
+ if (provided == null) {
+ throw new IllegalArgumentException(
+ "Provided interface name of internal component must be specified");
}
}
@Override
public boolean isViolated(Edge aEdge) {
- if (aEdge.getFrom() instanceof ExternalProvidedInterfaceNode
- && aEdge.getTo() instanceof ProvidedInterfaceNode) {
+ if (aEdge.getFrom() instanceof ExternalProvidedInterfaceNode &&
+ aEdge.getTo() instanceof ProvidedInterfaceNode) {
return isViolated((ExternalProvidedInterfaceNode) aEdge.getFrom(),
- (ProvidedInterfaceNode) aEdge.getTo());
+ (ProvidedInterfaceNode) aEdge.getTo());
}
+
return false;
}
private boolean isViolated(ExternalProvidedInterfaceNode aFrom,
- ProvidedInterfaceNode aTo) {
- if ( !aFrom.getName().equals(_externalProvided)) {
+ ProvidedInterfaceNode aTo) {
+ if (!aFrom.getName().equals(externalProvided)) {
return false; // wrong provided interface.
}
- if ( aTo.getComponent().getName().equals(_component) &&
- aTo.getProvided().getName().equals(_provided) ) {
- return false; // ok
+
+ if (aTo.getComponent().getName().equals(component) &&
+ aTo.getProvided().getName().equals(provided)) {
+ return false; // ok
}
- return true;
+
+ return true;
}
}