(no commit message)
[utils] / system / general / src / main / java / org / wamblee / system / graph / component / ConnectRequiredExternallyRequiredEdgeFilter.java
index c70840281ecda2e38e3a4f7cffa98199f97fd610..4428284ab170870ca02a31de4f2d0bc57d7a9995 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -23,52 +23,66 @@ import org.wamblee.system.graph.EdgeFilter;
  * container.
  * 
  * @author Erik Brakkee
- * 
  */
 public class ConnectRequiredExternallyRequiredEdgeFilter implements EdgeFilter {
+    private String client;
+
+    private String required;
+
+    private String externalRequired;
 
-    private String _client;
-    private String _required;
-    private String _externalRequired;
+    /**
+     * Creates a new ConnectRequiredExternallyRequiredEdgeFilter object.
+     * 
+     */
+    public ConnectRequiredExternallyRequiredEdgeFilter(String aClient,
+        String aRequired, String aExternalRequired) {
+        client = aClient;
+        required = aRequired;
+        externalRequired = aExternalRequired;
 
-    public ConnectRequiredExternallyRequiredEdgeFilter(String aClient, String aRequired,
-            String aExternalRequired) {
-        _client = aClient;
-        _required = aRequired;
-        _externalRequired = aExternalRequired; 
-        if ( _client == null ) { 
-            throw new IllegalArgumentException("Client component must be specified"); 
+        if (client == null) {
+            throw new IllegalArgumentException(
+                "Client component must be specified");
         }
-        if ( _required == null ) { 
-            throw new IllegalArgumentException("Required interface must be specified");
+
+        if (required == null) {
+            throw new IllegalArgumentException(
+                "Required interface must be specified");
         }
-        if ( _externalRequired == null ) { 
-            throw new IllegalArgumentException("External required interface must be specified");
+
+        if (externalRequired == null) {
+            throw new IllegalArgumentException(
+                "External required interface must be specified");
         }
     }
 
     @Override
     public boolean isViolated(Edge aEdge) {
-        if (aEdge.getFrom() instanceof RequiredInterfaceNode
-                && aEdge.getTo() instanceof ExternalRequiredInterfaceNode) {
+        if (aEdge.getFrom() instanceof RequiredInterfaceNode &&
+            aEdge.getTo() instanceof ExternalRequiredInterfaceNode) {
             return isViolated((RequiredInterfaceNode) aEdge.getFrom(),
-                    (ExternalRequiredInterfaceNode) aEdge.getTo());
+                (ExternalRequiredInterfaceNode) aEdge.getTo());
         }
+
         return false;
     }
 
     private boolean isViolated(RequiredInterfaceNode aFrom,
-            ExternalRequiredInterfaceNode aTo) {
-        if ( !aFrom.getComponent().getName().equals(_client)) { 
-            return false; // wrong component. 
+        ExternalRequiredInterfaceNode aTo) {
+        if (!aFrom.getComponent().getName().equals(client)) {
+            return false; // wrong component.
         }
-        if ( !(_required == null || aFrom.getRequired().getName().equals(_required))) { 
+
+        if (!((required == null) || aFrom.getRequired().getName().equals(
+            required))) {
             return false; // wrong interface
         }
-        if ( !aTo.getRequired().getName().equals(_externalRequired)) { 
-            return true; // wrong externally required interface.  
+
+        if (!aTo.getRequired().getName().equals(externalRequired)) {
+            return true; // wrong externally required interface.
         }
-      
-        return false; 
+
+        return false;
     }
 }