コード例 #1
0
    private static void compareNamesForSiblings (Collection clses1, Collection clses2) {
      if (clses1 == null || clses2 == null) return;
      Iterator i = clses1.iterator();

      while (i.hasNext()) {
        Cls nextCls1 = (Cls)i.next();
        Iterator j = clses2.iterator();
        while (j.hasNext()) {
          Cls nextCls2 = (Cls)j.next();
          if (CompareNames.compareNames(Util.getLocalBrowserText(nextCls1), Util.getLocalBrowserText (nextCls2)) == CompareNames.APPROXIMATE_MATCH) {
            AlgorithmUtils.createNewMatch(nextCls1, nextCls2, "multiple unmatched siblings with similar names", _results);
            _changesMade = true;
            j.remove();
            break;
          }
        }
      }
    }
コード例 #2
0
    private static void findMatch (Cls unmatchedCls, Collection unmatchedInO1, Collection unmatchedInO2) {
     	Collection superclasses = Util.getDirectSuperclasses(unmatchedCls);
        Iterator supers = superclasses.iterator();
        while (supers.hasNext()) {
         	Cls nextSuper = (Cls)supers.next();
            // **** need to deal with multiple images here
            Cls nextSuperImage = (Cls)_results.getFirstImage(nextSuper);
            if (nextSuperImage != null) {
                Collection nextSubs = new ArrayList(Util.getDirectSubclasses(nextSuper));
    	        Collection nextSubsImages = AlgorithmUtils.getImages (nextSubs, _results);
        	Collection nextSuperImageSubs = new ArrayList(Util.getDirectSubclasses(nextSuperImage));
            	nextSuperImageSubs.removeAll(nextSubsImages);
                nextSuperImageSubs.retainAll(unmatchedInO2);
	        nextSubs.retainAll(unmatchedInO1);

                // now, nextSubs has unmatched subclasses of nextSuper
            	// and nextSuperImageSubs contains unmatched subclasses of nextSuperImage

	        if (!nextSubs.isEmpty() && !nextSuperImageSubs.isEmpty())
        	    compareNamesForSiblings (nextSubs, nextSuperImageSubs);
                AlgorithmUtils.removeClsesWithSingleParent (nextSubs, unmatchedInO1);
            }
        }
    }