git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
source code formatting.
[utils]
/
system
/
general
/
src
/
main
/
java
/
org
/
wamblee
/
system
/
graph
/
component
/
ConnectRequiredProvidedEdgeFilter.java
diff --git
a/system/general/src/main/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilter.java
b/system/general/src/main/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilter.java
index a3c3f6d585cf4a1d61038a1515b3141690445a5e..bb6b1343631d04b39c7e611ddafec1ee9519ea82 100644
(file)
--- a/
system/general/src/main/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilter.java
+++ b/
system/general/src/main/java/org/wamblee/system/graph/component/ConnectRequiredProvidedEdgeFilter.java
@@
-1,12
+1,12
@@
/*
* Copyright 2008 the original author or authors.
/*
* Copyright 2008 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.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@
-18,59
+18,99
@@
package org.wamblee.system.graph.component;
import org.wamblee.system.graph.Edge;
import org.wamblee.system.graph.EdgeFilter;
import org.wamblee.system.graph.Edge;
import org.wamblee.system.graph.EdgeFilter;
+
/**
/**
- * Filter used to explicitly connect required and provided interfaces
within a
- * container.
- *
+ * Filter used to explicitly connect required and provided interfaces
+ *
within a
container.
+ *
* @author Erik Brakkee
* @author Erik Brakkee
- *
*/
public class ConnectRequiredProvidedEdgeFilter implements EdgeFilter {
*/
public class ConnectRequiredProvidedEdgeFilter implements EdgeFilter {
-
+ /**
+ * DOCUMENT ME!
+ */
private String client;
private String client;
+
+ /**
+ * DOCUMENT ME!
+ */
private String required;
private String required;
+
+ /**
+ * DOCUMENT ME!
+ */
private String server;
private String server;
+
+ /**
+ * DOCUMENT ME!
+ */
private String provided;
private String provided;
+ /**
+ * Creates a new ConnectRequiredProvidedEdgeFilter object.
+ *
+ * @param aClient DOCUMENT ME!
+ * @param aRequired DOCUMENT ME!
+ * @param aServer DOCUMENT ME!
+ * @param aProvided DOCUMENT ME!
+ */
public ConnectRequiredProvidedEdgeFilter(String aClient, String aRequired,
public ConnectRequiredProvidedEdgeFilter(String aClient, String aRequired,
- String aServer, String aProvided) {
- client = aClient;
- required = aRequired;
- server = aServer;
- provided = aProvided;
- if ( client == null ) {
- throw new IllegalArgumentException("Client component must be specified");
+ String aServer, String aProvided) {
+ client = aClient;
+ required = aRequired;
+ server = aServer;
+ provided = aProvided;
+
+ if (client == null) {
+ throw new IllegalArgumentException(
+ "Client component must be specified");
}
}
}
}
+ /**
+ * DOCUMENT ME!
+ *
+ * @param aEdge DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
@Override
public boolean isViolated(Edge aEdge) {
if (aEdge.getFrom() instanceof RequiredInterfaceNode
&& aEdge.getTo() instanceof ProvidedInterfaceNode) {
return isViolated((RequiredInterfaceNode) aEdge.getFrom(),
@Override
public boolean isViolated(Edge aEdge) {
if (aEdge.getFrom() instanceof RequiredInterfaceNode
&& aEdge.getTo() instanceof ProvidedInterfaceNode) {
return isViolated((RequiredInterfaceNode) aEdge.getFrom(),
-
(ProvidedInterfaceNode) aEdge.getTo());
+ (ProvidedInterfaceNode) aEdge.getTo());
}
}
+
return false;
}
return false;
}
+ /**
+ * DOCUMENT ME!
+ *
+ * @param aFrom DOCUMENT ME!
+ * @param aTo DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
private boolean isViolated(RequiredInterfaceNode aFrom,
private boolean isViolated(RequiredInterfaceNode aFrom,
-
ProvidedInterfaceNode aTo) {
+ ProvidedInterfaceNode aTo) {
if (client.equals(aFrom.getComponent().getName())
if (client.equals(aFrom.getComponent().getName())
- && (
required == null || required.equals(aFrom.getRequired(
)
-
.getName()))) {
+ && (
(required == null
)
+
|| required.equals(aFrom.getRequired()
.getName()))) {
// From part matches.
// From part matches.
- if (
server == null ) {
+ if (
server == null) {
return true; // all connections are eliminated
}
return true; // all connections are eliminated
}
+
if (server.equals(aTo.getComponent().getName())
if (server.equals(aTo.getComponent().getName())
- && (
provided == null || provided.equals(aTo.getProvided(
)
-
.getName()))) {
+ && (
(provided == null
)
+
|| provided.equals(aTo.getProvided()
.getName()))) {
// to part matches also
return false;
// to part matches also
return false;
- }
- else {
+ } else {
// From matches and to doesn't so edgefilter is violated.
// From matches and to doesn't so edgefilter is violated.
- return true;
+ return true;
}
} else {
// From part does not match, restriction does not apply.
}
} else {
// From part does not match, restriction does not apply.