You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by sa...@apache.org on 2009/09/01 17:15:44 UTC
svn commit: r810088 -
/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Author: sagara
Date: Tue Sep 1 15:15:33 2009
New Revision: 810088
URL: http://svn.apache.org/viewvc?rev=810088&view=rev
Log:
Merging Woden-209 branch.
Modified:
webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Modified: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java?rev=810088&r1=810087&r2=810088&view=diff
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java (original)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java Tue Sep 1 15:15:33 2009
@@ -226,7 +226,56 @@
}
/* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#isEquivalentTo(WSDLComponent)
+ */
+ public boolean isEquivalentTo(WSDLComponent comp)
+ {
+ //compare object refs
+ if(this == comp) return true;
+
+ if(!(comp instanceof Interface)) {
+ return false;
+ }
+
+ Interface other = (Interface)comp;
+
+ //compare {name}
+ QName myName = getName();
+ if(myName != null && !myName.equals(other.getName())) return false;
+
+ /* To compare {extended interfaces} we cannot just retrieve and compare the two sets
+ * of extended Interface components because we'd enter a recursive loop. To get the
+ * extended interfaces (i.e. to resolve the qnames in the 'extends' attribute)
+ * we need to get the set of interfaces available to the Description, which in turn
+ * invokes this equivalence checking method.
+ * Instead, compare just the qnames in the 'extends' attributes, but we first
+ * eliminate any duplicate qnames to ensure we make a logical test for
+ * equivalence (i.e. use Set comparison).
+ */
+ Set thisExtendsSet = new HashSet(fExtends);
+ QName[] otherExtends = ((InterfaceElement)other).getExtendedInterfaceNames();
+ Set otherExtendsSet = new HashSet();
+ for(int i=0; i<otherExtends.length; i++)
+ {
+ otherExtendsSet.add(otherExtends[i]);
+ }
+ if(thisExtendsSet.size() != otherExtendsSet.size()) return false;
+ if(!(thisExtendsSet.containsAll(otherExtendsSet) && otherExtendsSet.containsAll(thisExtendsSet)))
+ {
+ return false;
+ }
+
+ //TODO compare {interface faults}
+ //TODO compare {interface operations}
+
+ return true;
+ }
+
+ /* (non-Javadoc)
* @see org.apache.woden.wsdl20.WSDLComponent#equals(WSDLComponent)
+ * @deprecated Use isEquivalentTo(WSDLComponent)
+ *
+ * TODO Remove. Deprecated, replaced by isEquivalentTo.
*/
public boolean equals(WSDLComponent comp)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org