public void testMappedEObjectMetrics() throws IOException { UMLData umlData = new UMLData(2000); Resource leftUML = umlData.getLeftUML(); final Metric<EObject> metric = new EObjectFullMetric(); FastMap<EObject> fastMap = new FastMap<EObject>(3) { @Override protected double distance(EObject target1, EObject target2) { return metric.distance(target1, target2); } }; TreeIterator<EObject> it = leftUML.getAllContents(); while (it.hasNext()) { EObject object = it.next(); fastMap.add(object); } ; Space<EObject> space = new TreeBackedSpace<EObject>(); fastMap.map(true, space); List<double[]> coordinates = new ArrayList<double[]>(); int count = 0; for (EObject object : space) { if (++count % 100 == 0) coordinates.add(space.getCoordinates(object)); } checkNormalized(coordinates, EuclideanMetric.INSTANCE); checkSymmetric(coordinates, EuclideanMetric.INSTANCE); }
public void testEObjectMetrics() throws IOException { UMLData umlData = new UMLData(2000); Resource leftUML = umlData.getLeftUML(); int count = 0; List<EObject> objects = new ArrayList<EObject>(); TreeIterator<EObject> it = leftUML.getAllContents(); while (it.hasNext()) { EObject object = it.next(); if (++count % 100 == 0) objects.add(object); } ; checkNormalized(objects, new EObjectFullMetric()); // checkSymmetric(objects, EMFSimilarityMetric.INSTANCE); }