<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Jorge Manrubia</title>
	<atom:link href="http://jorgemanrubia.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorgemanrubia.net</link>
	<description>Personal Page</description>
	<lastBuildDate>Thu, 12 Apr 2012 09:59:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on Generating JUnit Test Cases Dynamically by uvrt</title>
		<link>http://jorgemanrubia.net/2008/09/18/generating-junit-test-cases-dynamically/comment-page-1/#comment-572</link>
		<dc:creator>uvrt</dc:creator>
		<pubDate>Thu, 12 Apr 2012 09:59:54 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=48#comment-572</guid>
		<description>&lt;p&gt;Thanks for this great example! It helped me a lot.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for this great example! It helped me a lot.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using macros to create custom example groups in RSpec by Matt Green</title>
		<link>http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/comment-page-1/#comment-571</link>
		<dc:creator>Matt Green</dc:creator>
		<pubDate>Wed, 11 Apr 2012 19:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/#comment-571</guid>
		<description>&lt;p&gt;Incredible. Thank you!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Incredible. Thank you!</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Generating JUnit Test Cases Dynamically by Dhiraj</title>
		<link>http://jorgemanrubia.net/2008/09/18/generating-junit-test-cases-dynamically/comment-page-1/#comment-570</link>
		<dc:creator>Dhiraj</dc:creator>
		<pubDate>Fri, 23 Mar 2012 22:32:45 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=48#comment-570</guid>
		<description>&lt;p&gt;Simple way of creating dynamic test cases. Thanks for sharing.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Simple way of creating dynamic test cases. Thanks for sharing.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Jorge Manrubia</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-569</link>
		<dc:creator>Jorge Manrubia</dc:creator>
		<pubDate>Tue, 06 Mar 2012 09:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-569</guid>
		<description>&lt;p&gt;Great work!! Thanks a lot for sharing.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Great work!! Thanks a lot for sharing.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Annamalai</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-568</link>
		<dc:creator>Annamalai</dc:creator>
		<pubDate>Tue, 06 Mar 2012 09:10:41 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-568</guid>
		<description>&lt;p&gt;Thanks Jorge&lt;/p&gt;

&lt;p&gt;I am documenting only the 3 methods that i have changed or introduced. Please refer to the above implementation for the remaining part of the code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;haveEqualReference&lt;/li&gt;
&lt;li&gt;equalUnOrderedReferences&lt;/li&gt;
&lt;li&gt;compareReferenceObject&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Its a simple improvement.
Considering the fact that we may definitely have bi directional relationship in our models, during compare this may cause the compare algorithm to fail due to recursive running. Therefore we need a terminating condition.&lt;/p&gt;

&lt;p&gt;I have used references with containment false, as the terminating conditon wherein for these objects only Attribute Compare is used. Reference Compare is by passed.&lt;/p&gt;

&lt;p&gt;Please do feel free to write to me if you need any further information on the implementation.&lt;/p&gt;

&lt;p&gt;&lt;code lang=&quot;java&quot;&gt;
@Override
  protected boolean haveEqualReference(final EObject eObject1, final EObject eObject2, final EReference reference) {
    Object value1 = eObject1.eGet(reference);
    Object value2 = eObject2.eGet(reference);


    if (reference.isMany()) {

      // *** important change for Unordered Lists here:
      if (reference.isOrdered()) {
        return equals((List&lt;EObject&gt;) value1, (List&lt;EObject&gt;) value2);
      }

      /**
       * Handle Recursion or Bi Directional References. Only if they are containments, then we need to parse them
       * recursively. Otherwise is if it only association, then attribute level compare is enough.
       */
      boolean containment = reference.isContainment();
      if (containment) {
        return equalsUnOrdered((List&lt;EObject&gt;) value1, (List&lt;EObject&gt;) value2);
      }

      // In bidirectional references, if the object is the container of the current object being visited.
      // It can return true. You need not check on Containers.
      if (reference.isContainer()) {
        return true;
      }

      // Finally if we find out that they are not containments nor containers,
      // then they are treated as unorderedReferences.
      // These need to be compared only based on Attributes.
      return equalUnOrderedReferences((List&lt;EObject&gt;) value1, (List&lt;EObject&gt;) value2);
      // End of Compare.
    }

    if ((value1 != null) &amp;&amp; (value2 != null)) {

      boolean containment = reference.isContainment();
      boolean equals = true;
      if (containment) {
        equals = equals((EObject) value1, (EObject) value2);
      }
      else if (reference.isContainer()) {
        equals = true;
      }
      else {
        equals = compareReferenceObject((EObject) value1, (EObject) value2);
      }
      return equals;
    }

    return true;
  }

  /**
   * @param value1
   * @param value2
   * @return
   */
  private boolean equalUnOrderedReferences(final List&lt;EObject&gt; list1, final List&lt;EObject&gt; list2) {
    if (list1.size() != list2.size()) {
      // return false;
      if (this.trace) {
        System.out.println(&quot;Reference Sizes is not Equal&quot;);
      }
      return false;
    }


    // save the Equal pairs: list1 Elements as Key and list2 Elements as Value
    Map&lt;EObject, EObject&gt; equalFound = new HashMap&lt;EObject, EObject&gt;();
    boolean result = true;
    for (EObject list1El : list1) {
      // try to find an equal Element for list1El in list2
      for (EObject list2El : list2) {
        // skip Elements of list2 that already have an equal Element in list1
        if (!equalFound.containsValue(list2El)) {
          // if list list1El is equal to list2El save it the Map
          // Being only a Reference, we need to compare only its Attributes and not its further references.
          // Therefore i get only the Attributes and validate them.
          result = compareReferenceObject(list1El, list2El);
          if (result) {
            equalFound.put(list1El, list2El);
            break;
          }
        }
      }

      // if no equal Element for listEl1 was found in list2, they couldn&#039;t be equal
      if (!equalFound.containsKey(list1El)) {
        return false;
      }

    }

    // For all Elements of list1 an own equal Element in list2 was found.
    return result;
  }

  /**
   * @param result
   * @param object1
   * @param object2
   * @return
   */
  private boolean compareReferenceObject(final EObject object1, final EObject object2) {
    boolean result = true;
    EList&lt;EAttribute&gt; eAllAttributes = object1.eClass().getEAllAttributes();
    for (EAttribute eAttribute : eAllAttributes) {
      if (!haveEqualAttribute(object1, object2, eAttribute)) {
        result = false;
        break;
      }
    }
    if (result) {
      compareMap.put(object1, object2);
    }
    else {
      compareMap.put(object1, null);
    }
    return result;
  }
&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks Jorge</p>

<p>I am documenting only the 3 methods that i have changed or introduced. Please refer to the above implementation for the remaining part of the code.</p>

<ol>
<li>haveEqualReference</li>
<li>equalUnOrderedReferences</li>
<li>compareReferenceObject</li>
</ol>

<p>Its a simple improvement.
Considering the fact that we may definitely have bi directional relationship in our models, during compare this may cause the compare algorithm to fail due to recursive running. Therefore we need a terminating condition.</p>

<p>I have used references with containment false, as the terminating conditon wherein for these objects only Attribute Compare is used. Reference Compare is by passed.</p>

<p>Please do feel free to write to me if you need any further information on the implementation.</p>

<p>

<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@Override<br />
&nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">boolean</span> haveEqualReference<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> EObject eObject1, <span style="color: #000000; font-weight: bold;">final</span> EObject eObject2, <span style="color: #000000; font-weight: bold;">final</span> EReference reference<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a> value1 <span style="color: #339933;">=</span> eObject1.<span style="color: #006633;">eGet</span><span style="color: #009900;">&#40;</span>reference<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a> value2 <span style="color: #339933;">=</span> eObject2.<span style="color: #006633;">eGet</span><span style="color: #009900;">&#40;</span>reference<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reference.<span style="color: #006633;">isMany</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// *** important change for Unordered Lists here:</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reference.<span style="color: #006633;">isOrdered</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> equals<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value1, <span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp;* Handle Recursion or Bi Directional References. Only if they are containments, then we need to parse them<br />
&nbsp; &nbsp; &nbsp; &nbsp;* recursively. Otherwise is if it only association, then attribute level compare is enough.<br />
&nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> containment <span style="color: #339933;">=</span> reference.<span style="color: #006633;">isContainment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>containment<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> equalsUnOrdered<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value1, <span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// In bidirectional references, if the object is the container of the current object being visited.</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// It can return true. You need not check on Containers.</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reference.<span style="color: #006633;">isContainer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Finally if we find out that they are not containments nor containers,</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// then they are treated as unorderedReferences.</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// These need to be compared only based on Attributes.</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> equalUnOrderedReferences<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value1, <span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> value2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// End of Compare.</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>value1 <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>value2 <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> containment <span style="color: #339933;">=</span> reference.<span style="color: #006633;">isContainment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> equals <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>containment<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; equals <span style="color: #339933;">=</span> equals<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>EObject<span style="color: #009900;">&#41;</span> value1, <span style="color: #009900;">&#40;</span>EObject<span style="color: #009900;">&#41;</span> value2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reference.<span style="color: #006633;">isContainer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; equals <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; equals <span style="color: #339933;">=</span> compareReferenceObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>EObject<span style="color: #009900;">&#41;</span> value1, <span style="color: #009900;">&#40;</span>EObject<span style="color: #009900;">&#41;</span> value2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> equals<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp;* @param value1<br />
&nbsp; &nbsp;* @param value2<br />
&nbsp; &nbsp;* @return<br />
&nbsp; &nbsp;*/</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> equalUnOrderedReferences<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span> list1, <span style="color: #000000; font-weight: bold;">final</span> List<span style="color: #339933;">&lt;</span>EObject<span style="color: #339933;">&gt;</span> list2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>list1.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> list2.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// return false;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">trace</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Reference Sizes is not Equal&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// save the Equal pairs: list1 Elements as Key and list2 Elements as Value</span><br />
&nbsp; &nbsp; Map<span style="color: #339933;">&lt;</span>EObject, EObject<span style="color: #339933;">&gt;</span> equalFound <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>EObject, EObject<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>EObject list1El <span style="color: #339933;">:</span> list1<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// try to find an equal Element for list1El in list2</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>EObject list2El <span style="color: #339933;">:</span> list2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// skip Elements of list2 that already have an equal Element in list1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>equalFound.<span style="color: #006633;">containsValue</span><span style="color: #009900;">&#40;</span>list2El<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// if list list1El is equal to list2El save it the Map</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Being only a Reference, we need to compare only its Attributes and not its further references.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Therefore i get only the Attributes and validate them.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result <span style="color: #339933;">=</span> compareReferenceObject<span style="color: #009900;">&#40;</span>list1El, list2El<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; equalFound.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>list1El, list2El<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// if no equal Element for listEl1 was found in list2, they couldn't be equal</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>equalFound.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span>list1El<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// For all Elements of list1 an own equal Element in list2 was found.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp;* @param result<br />
&nbsp; &nbsp;* @param object1<br />
&nbsp; &nbsp;* @param object2<br />
&nbsp; &nbsp;* @return<br />
&nbsp; &nbsp;*/</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> compareReferenceObject<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> EObject object1, <span style="color: #000000; font-weight: bold;">final</span> EObject object2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; EList<span style="color: #339933;">&lt;</span>EAttribute<span style="color: #339933;">&gt;</span> eAllAttributes <span style="color: #339933;">=</span> object1.<span style="color: #006633;">eClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getEAllAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>EAttribute eAttribute <span style="color: #339933;">:</span> eAllAttributes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>haveEqualAttribute<span style="color: #009900;">&#40;</span>object1, object2, eAttribute<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; result <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; compareMap.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>object1, object2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; compareMap.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>object1, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span></div></div>

</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Jorge Manrubia</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-567</link>
		<dc:creator>Jorge Manrubia</dc:creator>
		<pubDate>Mon, 05 Mar 2012 13:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-567</guid>
		<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Great. You can share your code wrapping it with a &lt;code&gt; tag:&lt;/p&gt;

&lt;p&gt;&lt;code lang=&quot;java&quot;&gt;&lt;br/&gt;//your code here&lt;br/&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But don&#039;t worry, just post it and I will format it if there is any problem. Thanks a lot for sharing&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,</p>

<p>Great. You can share your code wrapping it with a &lt;code&gt; tag:</p>

<p>&lt;code lang=&quot;java&quot;&gt;<br />//your code here<br />&lt;/code&gt;</p>

<p>But don&#8217;t worry, just post it and I will format it if there is any problem. Thanks a lot for sharing</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Annamalai</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-566</link>
		<dc:creator>Annamalai</dc:creator>
		<pubDate>Mon, 05 Mar 2012 05:19:03 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-566</guid>
		<description>&lt;p&gt;Thanks Mate ! I found the problem and as guessed it is due to bi directional references which are associations. Therefore i have altered to code a little bit to handle such scenarios.&lt;/p&gt;

&lt;p&gt;If you find a reference &amp; if the reference is not of containment type then i handle it in a different manner instead of letting it into equalsUnOrdered method. When they are references without containment true, only their attributes need to be compared. Therefore i divert the call into a new method for comparing references without containment. This halts the implementation from getting into any sort of recursive calling due to bi directional relationship. Not sure how to attach the code otherwise would be happy to do so.&lt;/p&gt;

&lt;p&gt;Do let me know how to attach the code to this comment, i would do it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks Mate ! I found the problem and as guessed it is due to bi directional references which are associations. Therefore i have altered to code a little bit to handle such scenarios.</p>

<p>If you find a reference &amp; if the reference is not of containment type then i handle it in a different manner instead of letting it into equalsUnOrdered method. When they are references without containment true, only their attributes need to be compared. Therefore i divert the call into a new method for comparing references without containment. This halts the implementation from getting into any sort of recursive calling due to bi directional relationship. Not sure how to attach the code otherwise would be happy to do so.</p>

<p>Do let me know how to attach the code to this comment, i would do it.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Jorge Manrubia</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-565</link>
		<dc:creator>Jorge Manrubia</dc:creator>
		<pubDate>Thu, 23 Feb 2012 08:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-565</guid>
		<description>&lt;p&gt;Hi. Sorry, when I was using this I didn&#039;t have any recursion problem. This solution was implemented some time ago and I am no longer working with EMF models anymore, so I am afraid I can&#039;t be very helpful here. If it won&#039;t end I imagine it has do with some association that is being followed when browsing the model and enter in a loop. I hope you found the problem&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi. Sorry, when I was using this I didn&#8217;t have any recursion problem. This solution was implemented some time ago and I am no longer working with EMF models anymore, so I am afraid I can&#8217;t be very helpful here. If it won&#8217;t end I imagine it has do with some association that is being followed when browsing the model and enter in a loop. I hope you found the problem</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Comparing EMF Models by Annamalai</title>
		<link>http://jorgemanrubia.net/2008/07/06/comparing-emf-models/comment-page-1/#comment-564</link>
		<dc:creator>Annamalai</dc:creator>
		<pubDate>Thu, 23 Feb 2012 05:05:02 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/blog/?p=30#comment-564</guid>
		<description>&lt;p&gt;Thanks dude for the solution. It really works great.
We have used the code above and it works fine for quiet a bit of EMF Models.
But sometimes it just runs endlessly for very long, i suppose it gets into a recursion that is endless when there are bi directional relationships.&lt;/p&gt;

&lt;p&gt;I am not sure though. But did you guys get anything like that during your working on this.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks dude for the solution. It really works great.
We have used the code above and it works fine for quiet a bit of EMF Models.
But sometimes it just runs endlessly for very long, i suppose it gets into a recursion that is endless when there are bi directional relationships.</p>

<p>I am not sure though. But did you guys get anything like that during your working on this.</p>]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using delayed_job with Cucumber by Jorge Manrubia</title>
		<link>http://jorgemanrubia.net/2010/09/01/using-delayed_job-with-cucumber/comment-page-1/#comment-563</link>
		<dc:creator>Jorge Manrubia</dc:creator>
		<pubDate>Wed, 26 Oct 2011 09:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/?p=523#comment-563</guid>
		<description>&lt;p&gt;Hi Phil. I am using a :deletion strategy. Anyway, I was using a :transaction strategy before and I didn&#039;t have problems with delayed_job. You can aslo leave delayed_job out of the deletion strategy if you use the :except option (I don&#039;t do it). Thanks for your feedback&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Phil. I am using a :deletion strategy. Anyway, I was using a :transaction strategy before and I didn&#8217;t have problems with delayed_job. You can aslo leave delayed_job out of the deletion strategy if you use the :except option (I don&#8217;t do it). Thanks for your feedback</p>]]></content:encoded>
	</item>
</channel>
</rss>

