Example #1
0
  /** Compares the locations and prints the results to the specified files. */
  public boolean compareLocationSets(
      Collection refLocations, Collection newLocations, String refFile, String testFile) {
    boolean foundDifferences = false;
    try {
      if (refLocations.size() != newLocations.size()) {
        printErrorMessageForDifferentCollections();
        throw new TVLAException("Different location sets!");
      }

      LocationComparatorByLabel locComparator = new LocationComparatorByLabel();
      Iterator refLocIterator = refLocations.iterator();

      while (refLocIterator.hasNext()) {
        Location refLoc = (Location) refLocIterator.next();
        Location newLoc = (Location) tvla.util.Find.findEqual(newLocations, refLoc, locComparator);
        if (newLoc == null) {
          printErrorMessageForDifferentCollections();
          throw new TVLAException("Different location sets!");
        }
        ArrayList diffRef = new ArrayList();
        ArrayList diffNew = new ArrayList();
        StructureCollectionsDiff differentiator = new StructureCollectionsDiff();
        differentiator.diff(refLoc.structures, newLoc.structures, diffRef, diffNew);
        printDifferences(refLoc.label(), diffRef, diffNew, refFile, testFile);
        if (diffNew.isEmpty() == false || diffRef.isEmpty() == false) foundDifferences = true;
      }
      return foundDifferences;
    } finally {
      cleanup();
    }
  }
Example #2
0
 @Override
 public void clearLocation() {
   super.clearLocation();
   unprocessed = null;
   element = new CartesianElement();
   element.setCachingMode(cachingMode);
   old = new CartesianElement();
   old.setCachingMode(cachingMode);
 }