├── .gitignore ├── LICENSE ├── README.md ├── net.sourceforge.metrics.feature ├── .project ├── build.properties ├── feature.xml └── license.html ├── net.sourceforge.metrics ├── .classpath ├── .project ├── META-INF │ └── MANIFEST.MF ├── about.ini ├── anttasks │ └── net │ │ └── sourceforge │ │ └── metrics │ │ └── ant │ │ ├── AntConsoleProgressMonitor.java │ │ ├── EnableMetricsTask.java │ │ ├── ExportMetricsTask.java │ │ ├── ProjectBuild.java │ │ └── ProjectBuildWorkspaceModifyOperation.java ├── build.properties ├── classes │ └── .gitignore ├── classycle │ └── classycle │ │ └── graph │ │ ├── AtomicVertex.java │ │ ├── Attributes.java │ │ ├── GraphAttributes.java │ │ ├── GraphProcessor.java │ │ ├── LongestWalkProcessor.java │ │ ├── StrongComponent.java │ │ ├── StrongComponentProcessor.java │ │ └── Vertex.java ├── doc │ ├── apidocs │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-files │ │ │ ├── index-1.html │ │ │ ├── index-10.html │ │ │ ├── index-11.html │ │ │ ├── index-12.html │ │ │ ├── index-13.html │ │ │ ├── index-14.html │ │ │ ├── index-15.html │ │ │ ├── index-16.html │ │ │ ├── index-17.html │ │ │ ├── index-18.html │ │ │ ├── index-19.html │ │ │ ├── index-2.html │ │ │ ├── index-20.html │ │ │ ├── index-21.html │ │ │ ├── index-22.html │ │ │ ├── index-23.html │ │ │ ├── index-3.html │ │ │ ├── index-4.html │ │ │ ├── index-5.html │ │ │ ├── index-6.html │ │ │ ├── index-7.html │ │ │ ├── index-8.html │ │ │ └── index-9.html │ │ ├── index.html │ │ ├── net │ │ │ └── sourceforge │ │ │ │ └── metrics │ │ │ │ ├── ant │ │ │ │ ├── AntConsoleProgressMonitor.html │ │ │ │ ├── EnableMetricsTask.html │ │ │ │ ├── ExportMetricsTask.html │ │ │ │ ├── ProjectBuild.html │ │ │ │ ├── ProjectBuildWorkspaceModifyOperation.html │ │ │ │ ├── class-use │ │ │ │ │ ├── AntConsoleProgressMonitor.html │ │ │ │ │ ├── EnableMetricsTask.html │ │ │ │ │ ├── ExportMetricsTask.html │ │ │ │ │ ├── ProjectBuild.html │ │ │ │ │ └── ProjectBuildWorkspaceModifyOperation.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── builder │ │ │ │ ├── IMetricsProgressListener.html │ │ │ │ ├── MetricsBuilder.AddedCommand.html │ │ │ │ ├── MetricsBuilder.CalculatorThread.html │ │ │ │ ├── MetricsBuilder.ChangedCommand.html │ │ │ │ ├── MetricsBuilder.Command.html │ │ │ │ ├── MetricsBuilder.FilterResult.html │ │ │ │ ├── MetricsBuilder.MetricsBuildVisitor.html │ │ │ │ ├── MetricsBuilder.Queue.html │ │ │ │ ├── MetricsBuilder.RemovedCommand.html │ │ │ │ ├── MetricsBuilder.html │ │ │ │ ├── MetricsNature.html │ │ │ │ ├── ProgressQueue.html │ │ │ │ ├── Semaphore.html │ │ │ │ ├── class-use │ │ │ │ │ ├── IMetricsProgressListener.html │ │ │ │ │ ├── MetricsBuilder.AddedCommand.html │ │ │ │ │ ├── MetricsBuilder.CalculatorThread.html │ │ │ │ │ ├── MetricsBuilder.ChangedCommand.html │ │ │ │ │ ├── MetricsBuilder.Command.html │ │ │ │ │ ├── MetricsBuilder.FilterResult.html │ │ │ │ │ ├── MetricsBuilder.MetricsBuildVisitor.html │ │ │ │ │ ├── MetricsBuilder.Queue.html │ │ │ │ │ ├── MetricsBuilder.RemovedCommand.html │ │ │ │ │ ├── MetricsBuilder.html │ │ │ │ │ ├── MetricsNature.html │ │ │ │ │ ├── ProgressQueue.html │ │ │ │ │ └── Semaphore.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── calculators │ │ │ │ ├── AbstractLinesOfCode.html │ │ │ │ ├── Calculator.html │ │ │ │ ├── InheritanceDepth.html │ │ │ │ ├── InvalidSourceException.html │ │ │ │ ├── LackOfCohesion.Preferences.html │ │ │ │ ├── LackOfCohesion.html │ │ │ │ ├── LinesOfCode.html │ │ │ │ ├── McCabe.html │ │ │ │ ├── MethodLinesOfCode.html │ │ │ │ ├── NestedBlockDepth.html │ │ │ │ ├── Norm.Preferences.html │ │ │ │ ├── Norm.html │ │ │ │ ├── NumberOfAttributes.html │ │ │ │ ├── NumberOfMethods.html │ │ │ │ ├── NumberOfParameters.html │ │ │ │ ├── RMartinCouplings.AfferentCollector.html │ │ │ │ ├── RMartinCouplings.EfferentCollector.html │ │ │ │ ├── RMartinCouplings.html │ │ │ │ ├── SpecializationIndex.html │ │ │ │ ├── TotalLinesOfCode.html │ │ │ │ ├── class-use │ │ │ │ │ ├── AbstractLinesOfCode.html │ │ │ │ │ ├── Calculator.html │ │ │ │ │ ├── InheritanceDepth.html │ │ │ │ │ ├── InvalidSourceException.html │ │ │ │ │ ├── LackOfCohesion.Preferences.html │ │ │ │ │ ├── LackOfCohesion.html │ │ │ │ │ ├── LinesOfCode.html │ │ │ │ │ ├── McCabe.html │ │ │ │ │ ├── MethodLinesOfCode.html │ │ │ │ │ ├── NestedBlockDepth.html │ │ │ │ │ ├── Norm.Preferences.html │ │ │ │ │ ├── Norm.html │ │ │ │ │ ├── NumberOfAttributes.html │ │ │ │ │ ├── NumberOfMethods.html │ │ │ │ │ ├── NumberOfParameters.html │ │ │ │ │ ├── RMartinCouplings.AfferentCollector.html │ │ │ │ │ ├── RMartinCouplings.EfferentCollector.html │ │ │ │ │ ├── RMartinCouplings.html │ │ │ │ │ ├── SpecializationIndex.html │ │ │ │ │ └── TotalLinesOfCode.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── core │ │ │ │ ├── Avg.html │ │ │ │ ├── CalculatorDescriptor.html │ │ │ │ ├── Constants.html │ │ │ │ ├── ExportDescriptor.html │ │ │ │ ├── ICalculator.html │ │ │ │ ├── IExporter.html │ │ │ │ ├── Log.html │ │ │ │ ├── Max.html │ │ │ │ ├── Metric.html │ │ │ │ ├── MetricDescriptor.html │ │ │ │ ├── MetricsPlugin.html │ │ │ │ ├── MetricsPreferenceInitializer.html │ │ │ │ ├── Sum.html │ │ │ │ ├── class-use │ │ │ │ │ ├── Avg.html │ │ │ │ │ ├── CalculatorDescriptor.html │ │ │ │ │ ├── Constants.html │ │ │ │ │ ├── ExportDescriptor.html │ │ │ │ │ ├── ICalculator.html │ │ │ │ │ ├── IExporter.html │ │ │ │ │ ├── Log.html │ │ │ │ │ ├── Max.html │ │ │ │ │ ├── Metric.html │ │ │ │ │ ├── MetricDescriptor.html │ │ │ │ │ ├── MetricsPlugin.html │ │ │ │ │ ├── MetricsPreferenceInitializer.html │ │ │ │ │ └── Sum.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ ├── package-use.html │ │ │ │ └── sources │ │ │ │ │ ├── AbstractMetricSource.html │ │ │ │ │ ├── Cache.html │ │ │ │ │ ├── CompilationUnitMetrics.html │ │ │ │ │ ├── Dispatcher.html │ │ │ │ │ ├── GraphContributor.html │ │ │ │ │ ├── IGraphContributor.html │ │ │ │ │ ├── MethodMetrics.html │ │ │ │ │ ├── PackageFragmentMetrics.html │ │ │ │ │ ├── PackageFragmentRootMetrics.html │ │ │ │ │ ├── ProjectMetrics.html │ │ │ │ │ ├── TypeMetrics.html │ │ │ │ │ ├── class-use │ │ │ │ │ ├── AbstractMetricSource.html │ │ │ │ │ ├── Cache.html │ │ │ │ │ ├── CompilationUnitMetrics.html │ │ │ │ │ ├── Dispatcher.html │ │ │ │ │ ├── IGraphContributor.html │ │ │ │ │ ├── MethodMetrics.html │ │ │ │ │ ├── PackageFragmentMetrics.html │ │ │ │ │ ├── PackageFragmentRootMetrics.html │ │ │ │ │ ├── ProjectMetrics.html │ │ │ │ │ └── TypeMetrics.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ ├── package-tree.html │ │ │ │ │ └── package-use.html │ │ │ │ ├── internal │ │ │ │ ├── tests │ │ │ │ │ ├── AllTests.html │ │ │ │ │ ├── AvgTests.html │ │ │ │ │ ├── MaxTests.html │ │ │ │ │ ├── class-use │ │ │ │ │ │ ├── AllTests.html │ │ │ │ │ │ ├── AvgTests.html │ │ │ │ │ │ └── MaxTests.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ ├── package-tree.html │ │ │ │ │ └── package-use.html │ │ │ │ └── xml │ │ │ │ │ ├── CompilationUnitXMLExporter.html │ │ │ │ │ ├── IXMLExporter.html │ │ │ │ │ ├── MethodXMLExporter.html │ │ │ │ │ ├── MetricsExporter.html │ │ │ │ │ ├── MetricsFirstExporter.SoftCache.html │ │ │ │ │ ├── MetricsFirstExporter.html │ │ │ │ │ ├── PackageFragmentXMLExporter.html │ │ │ │ │ ├── PackageRootXMLExporter.html │ │ │ │ │ ├── ProjectXMLExporter.html │ │ │ │ │ ├── TypeXMLExporter.html │ │ │ │ │ ├── XMLPrintStream.html │ │ │ │ │ ├── XMLSourceTreeExporter.html │ │ │ │ │ ├── class-use │ │ │ │ │ ├── CompilationUnitXMLExporter.html │ │ │ │ │ ├── IXMLExporter.html │ │ │ │ │ ├── MethodXMLExporter.html │ │ │ │ │ ├── MetricsExporter.html │ │ │ │ │ ├── MetricsFirstExporter.SoftCache.html │ │ │ │ │ ├── MetricsFirstExporter.html │ │ │ │ │ ├── PackageFragmentXMLExporter.html │ │ │ │ │ ├── PackageRootXMLExporter.html │ │ │ │ │ ├── ProjectXMLExporter.html │ │ │ │ │ ├── TypeXMLExporter.html │ │ │ │ │ ├── XMLPrintStream.html │ │ │ │ │ └── XMLSourceTreeExporter.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ ├── package-tree.html │ │ │ │ │ └── package-use.html │ │ │ │ ├── propagators │ │ │ │ ├── AvgAvg.html │ │ │ │ ├── AvgValue.html │ │ │ │ ├── MaxMax.html │ │ │ │ ├── MaxValue.html │ │ │ │ ├── Propagator.html │ │ │ │ ├── Sum.html │ │ │ │ ├── class-use │ │ │ │ │ ├── AvgAvg.html │ │ │ │ │ ├── AvgValue.html │ │ │ │ │ ├── MaxMax.html │ │ │ │ │ ├── MaxValue.html │ │ │ │ │ ├── Propagator.html │ │ │ │ │ └── Sum.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── properties │ │ │ │ ├── ExclusionPatternDialog.html │ │ │ │ ├── MetricsPropertyPage.EnableMetricsTable.html │ │ │ │ ├── MetricsPropertyPage.html │ │ │ │ ├── class-use │ │ │ │ │ ├── ExclusionPatternDialog.html │ │ │ │ │ ├── MetricsPropertyPage.EnableMetricsTable.html │ │ │ │ │ └── MetricsPropertyPage.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ └── ui │ │ │ │ ├── AbortMetrics.html │ │ │ │ ├── DependencyGraphView.html │ │ │ │ ├── EnableMetrics.MetricsNatureException.html │ │ │ │ ├── EnableMetrics.html │ │ │ │ ├── MetricsActionGroup.html │ │ │ │ ├── MetricsTable.html │ │ │ │ ├── MetricsView.html │ │ │ │ ├── OpenMetricsViewAction.html │ │ │ │ ├── class-use │ │ │ │ ├── AbortMetrics.html │ │ │ │ ├── DependencyGraphView.html │ │ │ │ ├── EnableMetrics.MetricsNatureException.html │ │ │ │ ├── EnableMetrics.html │ │ │ │ ├── MetricsActionGroup.html │ │ │ │ ├── MetricsTable.html │ │ │ │ ├── MetricsView.html │ │ │ │ └── OpenMetricsViewAction.html │ │ │ │ ├── dependencies │ │ │ │ ├── DependencyGraphPanel.html │ │ │ │ ├── EclipseNode.html │ │ │ │ ├── Knot.html │ │ │ │ ├── PackageAttributes.html │ │ │ │ ├── PathFinder.Queue.html │ │ │ │ ├── PathFinder.html │ │ │ │ ├── PathFinderDialog.VertexLabelProvider.html │ │ │ │ ├── PathFinderDialog.VertexSorter.html │ │ │ │ ├── PathFinderDialog.html │ │ │ │ ├── TangleAnalyzer.PackageCollector.html │ │ │ │ ├── TangleAnalyzer.RefCollector.html │ │ │ │ ├── TangleAnalyzer.TypeCollector.html │ │ │ │ ├── TangleAnalyzer.html │ │ │ │ ├── TopoSort.html │ │ │ │ ├── TopoSortDialog.VertexLabelProvider.html │ │ │ │ ├── TopoSortDialog.VertexSorter.html │ │ │ │ ├── TopoSortDialog.html │ │ │ │ ├── class-use │ │ │ │ │ ├── DependencyGraphPanel.html │ │ │ │ │ ├── EclipseNode.html │ │ │ │ │ ├── Knot.html │ │ │ │ │ ├── PackageAttributes.html │ │ │ │ │ ├── PathFinder.Queue.html │ │ │ │ │ ├── PathFinder.html │ │ │ │ │ ├── PathFinderDialog.VertexLabelProvider.html │ │ │ │ │ ├── PathFinderDialog.VertexSorter.html │ │ │ │ │ ├── PathFinderDialog.html │ │ │ │ │ ├── TangleAnalyzer.PackageCollector.html │ │ │ │ │ ├── TangleAnalyzer.RefCollector.html │ │ │ │ │ ├── TangleAnalyzer.TypeCollector.html │ │ │ │ │ ├── TangleAnalyzer.html │ │ │ │ │ ├── TopoSort.html │ │ │ │ │ ├── TopoSortDialog.VertexLabelProvider.html │ │ │ │ │ ├── TopoSortDialog.VertexSorter.html │ │ │ │ │ └── TopoSortDialog.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── layeredpackagegraph │ │ │ │ ├── LayeredPackageGraphActionGroup.html │ │ │ │ ├── LayeredPackageGraphPanel.html │ │ │ │ ├── LayeredPackageGraphView.html │ │ │ │ ├── LayeredPackageTable.html │ │ │ │ ├── LayeredPackageTableView.html │ │ │ │ ├── LayeredTGLayout.html │ │ │ │ ├── PackageStats.html │ │ │ │ ├── class-use │ │ │ │ │ ├── LayeredPackageGraphActionGroup.html │ │ │ │ │ ├── LayeredPackageGraphPanel.html │ │ │ │ │ ├── LayeredPackageGraphView.html │ │ │ │ │ ├── LayeredPackageTable.html │ │ │ │ │ ├── LayeredPackageTableView.html │ │ │ │ │ ├── LayeredTGLayout.html │ │ │ │ │ └── PackageStats.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ ├── package-use.html │ │ │ │ └── preferences │ │ │ │ ├── ColorPreferencePage.html │ │ │ │ ├── LCOMPreferencePage.html │ │ │ │ ├── ListUpDownEditor.html │ │ │ │ ├── MetricsPreferencePage.html │ │ │ │ ├── NORMPreferencePage.html │ │ │ │ ├── RangePage.html │ │ │ │ ├── XMLExportPage.html │ │ │ │ ├── class-use │ │ │ │ ├── ColorPreferencePage.html │ │ │ │ ├── LCOMPreferencePage.html │ │ │ │ ├── ListUpDownEditor.html │ │ │ │ ├── MetricsPreferencePage.html │ │ │ │ ├── NORMPreferencePage.html │ │ │ │ ├── RangePage.html │ │ │ │ └── XMLExportPage.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── overview-frame.html │ │ ├── overview-summary.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── packages.html │ │ ├── resources │ │ │ └── inherit.gif │ │ ├── serialized-form.html │ │ └── stylesheet.css │ ├── colors.gif │ ├── export.gif │ ├── henderson.jpg │ ├── lcom.gif │ ├── martin.jpg │ ├── net.sourceforge.exporters.html │ ├── net.sourceforge.metrics.html │ ├── norm.gif │ ├── package_dependencies.gif │ ├── package_tangle.gif │ ├── preferences.gif │ ├── ranges.gif │ ├── shortest_path.gif │ ├── showview.gif │ ├── tangle_details.gif │ ├── toc.html │ └── view.gif ├── icons │ ├── abort.gif │ ├── export_xml.gif │ ├── gview.gif │ ├── mview.gif │ ├── pause.gif │ └── resume.gif ├── jdbm.jar ├── oldbuild.xml ├── plugin.xml ├── schema │ ├── exporters.exsd │ ├── metrics-first-flat.xsd │ └── net.sourceforge.metrics.exsd ├── src │ └── net │ │ └── sourceforge │ │ └── metrics │ │ ├── builder │ │ ├── IMetricsProgressListener.java │ │ ├── MetricsBuilder.java │ │ ├── MetricsNature.java │ │ ├── ProgressQueue.java │ │ ├── ProgressQueueCommand.java │ │ └── Semaphore.java │ │ ├── calculators │ │ ├── AbstractLinesOfCode.java │ │ ├── Calculator.java │ │ ├── InheritanceDepth.java │ │ ├── InvalidSourceException.java │ │ ├── LackOfCohesion.java │ │ ├── McCabe.java │ │ ├── MethodLinesOfCode.java │ │ ├── NestedBlockDepth.java │ │ ├── Norm.java │ │ ├── NumberOfAttributes.java │ │ ├── NumberOfInheritedMethods.java │ │ ├── NumberOfMethods.java │ │ ├── NumberOfParameters.java │ │ ├── RMartinCouplings.java │ │ ├── SpecializationIndex.java │ │ ├── SpecializationIndex2.java │ │ ├── TotalLinesOfCode.java │ │ ├── package.html │ │ └── qmood │ │ │ ├── AverageNumberOfAncestors.java │ │ │ ├── CohesionAmongMethodsOfClass.java │ │ │ ├── DirectClassCoupling.java │ │ │ ├── Effectiveness.java │ │ │ ├── Extendibility.java │ │ │ ├── Flexibility.java │ │ │ ├── Functionality.java │ │ │ ├── MeasureOfFunctionalAbstraction.java │ │ │ ├── NumberOfHierarchies.java │ │ │ ├── NumberOfNormalMethods.java │ │ │ ├── Reusability.java │ │ │ └── Understandability.java │ │ ├── core │ │ ├── Avg.java │ │ ├── CalculatorDescriptor.java │ │ ├── Constants.java │ │ ├── ExportDescriptor.java │ │ ├── ICalculator.java │ │ ├── IExporter.java │ │ ├── Log.java │ │ ├── Max.java │ │ ├── Metric.java │ │ ├── MetricDescriptor.java │ │ ├── MetricsPlugin.java │ │ ├── MetricsPreferenceInitializer.java │ │ ├── MetricsUtils.java │ │ ├── Sum.java │ │ └── sources │ │ │ ├── AbstractMetricSource.java │ │ │ ├── Cache.java │ │ │ ├── CompilationUnitMetrics.java │ │ │ ├── Dispatcher.java │ │ │ ├── IGraphContributor.java │ │ │ ├── MethodMetrics.java │ │ │ ├── PackageFragmentMetrics.java │ │ │ ├── PackageFragmentRootMetrics.java │ │ │ ├── ProjectMetrics.java │ │ │ └── TypeMetrics.java │ │ ├── internal │ │ └── xml │ │ │ ├── CompilationUnitXMLExporter.java │ │ │ ├── IXMLExporter.java │ │ │ ├── MethodXMLExporter.java │ │ │ ├── MetricsExporter.java │ │ │ ├── MetricsFirstExporter.java │ │ │ ├── PackageFragmentXMLExporter.java │ │ │ ├── PackageRootXMLExporter.java │ │ │ ├── ProjectXMLExporter.java │ │ │ ├── TypeXMLExporter.java │ │ │ ├── WinCompliantExporter.java │ │ │ ├── XMLPrintStream.java │ │ │ └── XMLSourceTreeExporter.java │ │ ├── propagators │ │ ├── AvgAvg.java │ │ ├── AvgValue.java │ │ ├── MaxMax.java │ │ ├── MaxValue.java │ │ ├── Propagator.java │ │ ├── Sum.java │ │ └── package.html │ │ ├── properties │ │ ├── ExclusionPatternDialog.java │ │ └── MetricsPropertyPage.java │ │ └── ui │ │ ├── AbortMetrics.java │ │ ├── DependencyGraphView.java │ │ ├── EnableMetrics.java │ │ ├── MetricsActionGroup.java │ │ ├── MetricsTable.java │ │ ├── MetricsView.java │ │ ├── OpenMetricsViewAction.java │ │ ├── dependencies │ │ ├── DependencyGraphPanel.java │ │ ├── EclipseNode.java │ │ ├── Knot.java │ │ ├── PackageAttributes.java │ │ ├── PathFinder.java │ │ ├── PathFinderDialog.java │ │ ├── TangleAnalyzer.java │ │ ├── TopoSort.java │ │ └── TopoSortDialog.java │ │ ├── layeredpackagegraph │ │ ├── LayeredPackageGraphActionGroup.java │ │ ├── LayeredPackageGraphPanel.java │ │ ├── LayeredPackageGraphView.java │ │ ├── LayeredPackageTable.java │ │ ├── LayeredPackageTableView.java │ │ ├── LayeredTGLayout.java │ │ └── PackageStats.java │ │ ├── package.html │ │ └── preferences │ │ ├── ColorPreferencePage.java │ │ ├── LCOMPreferencePage.java │ │ ├── ListUpDownEditor.java │ │ ├── MetricsPreferencePage.java │ │ ├── NORMPreferencePage.java │ │ ├── RangePage.java │ │ ├── XMLExportPage.java │ │ └── package.html ├── test │ └── net │ │ └── sourceforge │ │ └── metrics │ │ └── internal │ │ └── tests │ │ ├── AllTests.java │ │ ├── AvgTests.java │ │ └── MaxTests.java ├── tgsrc │ └── com │ │ └── touchgraph │ │ └── graphlayout │ │ ├── Edge.java │ │ ├── GLPanel.java │ │ ├── GraphLayoutApplet.java │ │ ├── GraphListener.java │ │ ├── LocalityUtils.java │ │ ├── Node.java │ │ ├── TGAbstractLens.java │ │ ├── TGException.java │ │ ├── TGLayout.java │ │ ├── TGLensSet.java │ │ ├── TGPaintListener.java │ │ ├── TGPanel.java │ │ ├── TGPoint2D.java │ │ ├── TGScrollPane.java │ │ ├── TGStarLayout.java │ │ ├── graphelements │ │ ├── GESUtils.java │ │ ├── GraphEltSet.java │ │ ├── ImmutableGraphEltSet.java │ │ ├── Locality.java │ │ ├── TGForEachEdge.java │ │ ├── TGForEachNode.java │ │ ├── TGForEachNodePair.java │ │ ├── TGNodeQueue.java │ │ └── VisibleLocality.java │ │ └── interaction │ │ ├── DragAddUI.java │ │ ├── DragMultiselectUI.java │ │ ├── DragNodeUI.java │ │ ├── GLEditUI.java │ │ ├── GLNavigateUI.java │ │ ├── HVRotateDragUI.java │ │ ├── HVScroll.java │ │ ├── HyperScroll.java │ │ ├── LocalityScroll.java │ │ ├── RotateScroll.java │ │ ├── TGAbstractClickUI.java │ │ ├── TGAbstractDragUI.java │ │ ├── TGAbstractMouseMotionUI.java │ │ ├── TGAbstractMousePausedUI.java │ │ ├── TGSelfDeactivatingUI.java │ │ ├── TGUIManager.java │ │ ├── TGUserInterface.java │ │ └── ZoomScroll.java ├── toc.xml ├── tocapi.xml ├── tocconcepts.xml ├── tocgettingstarted.xml └── welcome.xml └── updatesite ├── artifacts.jar ├── content.jar ├── features ├── net.sourceforge.metrics_1.3.10.jar └── net.sourceforge.metrics_1.3.9.jar └── plugins ├── net.sourceforge.metrics_1.3.10.jar └── net.sourceforge.metrics_1.3.9.jar /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | -------------------------------------------------------------------------------- /net.sourceforge.metrics.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | net.sourceforge.metrics.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /net.sourceforge.metrics.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml,\ 2 | license.html 3 | -------------------------------------------------------------------------------- /net.sourceforge.metrics.feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | This metrics plugin calculates various code and design metrics 10 | for Java projects. 11 | In addition to metrics such as McCabe cyclomatic complexity and 12 | the dependency metrics of Robert Martin and many others, it also 13 | includes a graphical dependency analysis tool based on the dynamic 14 | hyperbolic graphing package TouchGraph. 15 | 16 | 17 | 18 | (c) 2003 Frank Sauer 19 | (c) 2009 Guillaume Boissier 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | net.sourceforge.metrics 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | net.sourceforge.metrics.builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | net.sourceforge.metrics.nature 33 | 34 | 35 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/about.ini: -------------------------------------------------------------------------------- 1 | # about.ini 2 | # contains information about a feature 3 | # java.io.Properties file (ISO 8859-1 with "\" escapes) 4 | # "%key" are externalized strings defined in about.properties 5 | # This file does not need to be translated. 6 | # Property "welcomePage" contains path to welcome page (special XML-based format) 7 | # Property "welcomePerspective" contains the id of the perspective in which the 8 | # welcome page is to be opened. 9 | # optional 10 | aboutText=Metrics plugin for Eclipse\n\ 11 | \n\ 12 | Version: 1.3.3\n\ 13 | \n\ 14 | (c) Copyright Frank Sauer and others 2003.\n\ 15 | \n\ 16 | Visit http://metrics.sourceforge.net 17 | welcomePage=welcome.xml 18 | appName=Metrics -------------------------------------------------------------------------------- /net.sourceforge.metrics/anttasks/net/sourceforge/metrics/ant/ProjectBuildWorkspaceModifyOperation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * (C) Copyright IBM Corp. 2002 - All Rights Reserved. 3 | * 4 | * DISCLAIMER: 5 | * The following code is sample code created by IBM Corporation. 6 | * This sample code is not part of any standard IBM product and is 7 | * provided to you solely for the purpose of assisting you in the 8 | * development of your applications. The code is provided 'AS IS', 9 | * without warranty or condition of any kind. IBM shall not be liable 10 | * for any damages arising out of your use of the sample code, even 11 | * if it has been advised of the possibility of such damages. 12 | * 13 | * Modified by Frank Sauer (package name) 14 | */ 15 | package net.sourceforge.metrics.ant; 16 | 17 | import org.eclipse.core.resources.IProject; 18 | import org.eclipse.core.runtime.CoreException; 19 | import org.eclipse.core.runtime.IProgressMonitor; 20 | import org.eclipse.ui.actions.WorkspaceModifyOperation; 21 | 22 | public class ProjectBuildWorkspaceModifyOperation extends WorkspaceModifyOperation { 23 | private IProject project; 24 | private int buildTypeInt; 25 | 26 | public ProjectBuildWorkspaceModifyOperation(IProject proj, int buildType) { 27 | project = proj; 28 | buildTypeInt = buildType; 29 | } 30 | 31 | /** 32 | * Performs the steps that are to be treated as a single logical workspace change. 33 | * 34 | * @param monitor 35 | * to display progress and handle cancel requests 36 | * @exception CoreException 37 | * if the operation fails due to a CoreException 38 | */ 39 | @Override 40 | protected void execute(IProgressMonitor monitor) throws CoreException { 41 | String projectName = "unknown"; 42 | try { 43 | projectName = project.getDescription().getName(); 44 | monitor.setTaskName("Building: " + projectName); 45 | project.build(buildTypeInt, monitor); 46 | } catch (CoreException e) { 47 | throw e; 48 | } finally { 49 | monitor.done(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/build.properties: -------------------------------------------------------------------------------- 1 | source.metrics.jar = src/,\ 2 | classycle/,\ 3 | tgsrc/ 4 | bin.includes = metrics.jar,\ 5 | ant-metricstasks.jar,\ 6 | jdbm.jar,\ 7 | plugin.xml,\ 8 | icons/,\ 9 | doc/,\ 10 | toc.xml,\ 11 | tocapi.xml,\ 12 | tocconcepts.xml,\ 13 | tocgettingstarted.xml,\ 14 | welcome.xml,\ 15 | schema/,\ 16 | META-INF/ 17 | jars.compile.order = metrics.jar,\ 18 | ant-metricstasks.jar 19 | source.ant-metricstasks.jar = anttasks/ 20 | output.ant-metricstasks.jar = bin/ 21 | output.metrics.jar = bin/ 22 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/classes/.gitignore: -------------------------------------------------------------------------------- 1 | /classycle/ 2 | /com/ 3 | /net/ 4 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/classycle/classycle/graph/AtomicVertex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Franz-Josef Elmer, All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 23 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | package classycle.graph; 26 | 27 | /** 28 | * A subclass of {@link Vertex} with the following additional properties: 29 | * 34 | * The last two properties are used in Tarjan's algorithm to find the strong components (see {@link StrongComponentProcessor}). 35 | * 36 | * @author Franz-Josef Elmer 37 | */ 38 | public class AtomicVertex extends Vertex { 39 | private boolean _graphVertex; 40 | private int _order; 41 | private int _low; 42 | 43 | /** Creates an instance for the specified attributes. */ 44 | public AtomicVertex(Attributes attributes) { 45 | super(attributes); 46 | } 47 | 48 | /** 49 | * Reset this instance. That is, it becomes unvisited vertex of a graph with order and low set to -1; 50 | */ 51 | @Override 52 | public void reset() { 53 | super.reset(); 54 | _graphVertex = true; 55 | _order = -1; 56 | _low = -1; 57 | } 58 | 59 | /** Returns true if this vertex belongs to a graph. */ 60 | public boolean isGraphVertex() { 61 | return _graphVertex; 62 | } 63 | 64 | /** Returns the order of visiting. */ 65 | public int getOrder() { 66 | return _order; 67 | } 68 | 69 | /** Sets the order of visiting. */ 70 | public void setOrder(int order) { 71 | _order = order; 72 | } 73 | 74 | /** Returns the current value of the low function. */ 75 | public int getLow() { 76 | return _low; 77 | } 78 | 79 | /** Sets the current value of the low function. */ 80 | public void setLow(int low) { 81 | _low = low; 82 | } 83 | } // class -------------------------------------------------------------------------------- /net.sourceforge.metrics/classycle/classycle/graph/Attributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Franz-Josef Elmer, All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 23 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | package classycle.graph; 26 | 27 | /** 28 | * Marker interface of any general set of attributes a {@link Vertex} may have. These attributes are neither used or modified by any parsing or searching process. 29 | * 30 | * @author Franz-Josef Elmer 31 | */ 32 | public interface Attributes { 33 | } // interface -------------------------------------------------------------------------------- /net.sourceforge.metrics/classycle/classycle/graph/GraphAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Franz-Josef Elmer, All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 23 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | package classycle.graph; 26 | 27 | public interface GraphAttributes extends Attributes { 28 | public int getGirth(); 29 | 30 | public int getRadius(); 31 | 32 | public int getDiameter(); 33 | 34 | public Vertex[] getCenterVertices(); 35 | } // interface -------------------------------------------------------------------------------- /net.sourceforge.metrics/classycle/classycle/graph/LongestWalkProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Franz-Josef Elmer, All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 14 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 23 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | package classycle.graph; 26 | 27 | public class LongestWalkProcessor extends GraphProcessor { 28 | @Override 29 | protected void initializeProcessing(Vertex[] graph) { 30 | } 31 | 32 | @Override 33 | protected void processBefore(Vertex vertex) { 34 | StrongComponent component = castAsStrongComponent(vertex); 35 | component.setActive(true); 36 | component.setLongestWalk(0); 37 | } 38 | 39 | @Override 40 | protected void processArc(Vertex tail, Vertex head) { 41 | StrongComponent t = castAsStrongComponent(tail); 42 | StrongComponent h = castAsStrongComponent(head); 43 | if (!h.isVisited()) { 44 | process(h); 45 | } else if (h.isActive()) { 46 | // Oops! should never be happen if the graph has been created 47 | // with StrongComponentProcessor 48 | throw new IllegalArgumentException(h + " is not a strong component."); 49 | } 50 | t.setLongestWalk(Math.max(t.getLongestWalk(), 1 + h.getLongestWalk())); 51 | } 52 | 53 | @Override 54 | protected void processAfter(Vertex vertex) { 55 | castAsStrongComponent(vertex).setActive(false); 56 | } 57 | 58 | @Override 59 | protected void finishProcessing(Vertex[] graph) { 60 | // Sort in increasing walk lengths 61 | StrongComponent[] components = (StrongComponent[]) graph; 62 | for (int i = 0; i < graph.length; i++) { 63 | for (int j = i + 1; j < graph.length; j++) { 64 | if (components[j].getLongestWalk() < components[i].getLongestWalk()) { 65 | StrongComponent c = components[i]; 66 | components[i] = components[j]; 67 | components[j] = c; 68 | } 69 | } 70 | } 71 | } 72 | 73 | /** 74 | * Casts the specified vertex as an {@link StrongComponent}. 75 | * 76 | * @throws IllegalArgumentException 77 | * if vertex is not an instance of {@link StrongComponent}. 78 | */ 79 | private StrongComponent castAsStrongComponent(Vertex vertex) { 80 | if (vertex instanceof StrongComponent) { 81 | return (StrongComponent) vertex; 82 | } /* else { */ 83 | throw new IllegalArgumentException(vertex + " is not an instance of StrongComponent"); 84 | /* } */ 85 | } 86 | } // class -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Generated Documentation (Untitled) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <H2> 18 | Frame Alert</H2> 19 | 20 | <P> 21 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 22 | <BR> 23 | Link to<A HREF="overview-summary.html">Non-frame version.</A> 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/ant/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.ant 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.ant 20 | 21 | 22 | 35 | 36 |
23 | Classes  24 | 25 |
26 | AntConsoleProgressMonitor 27 |
28 | EnableMetricsTask 29 |
30 | ExportMetricsTask 31 |
32 | ProjectBuild 33 |
34 | ProjectBuildWorkspaceModifyOperation
37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/builder/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.builder 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.builder 20 | 21 | 22 | 27 | 28 |
23 | Interfaces  24 | 25 |
26 | IMetricsProgressListener
29 | 30 | 31 | 32 | 33 | 56 | 57 |
34 | Classes  35 | 36 |
37 | MetricsBuilder 38 |
39 | MetricsBuilder.AddedCommand 40 |
41 | MetricsBuilder.CalculatorThread 42 |
43 | MetricsBuilder.ChangedCommand 44 |
45 | MetricsBuilder.Command 46 |
47 | MetricsBuilder.Queue 48 |
49 | MetricsBuilder.RemovedCommand 50 |
51 | MetricsNature 52 |
53 | ProgressQueue 54 |
55 | Semaphore
58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/core/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.core 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.core 20 | 21 | 22 | 31 | 32 |
23 | Interfaces  24 | 25 |
26 | Constants 27 |
28 | ICalculator 29 |
30 | IExporter
33 | 34 | 35 | 36 | 37 | 60 | 61 |
38 | Classes  39 | 40 |
41 | Avg 42 |
43 | CalculatorDescriptor 44 |
45 | ExportDescriptor 46 |
47 | Log 48 |
49 | Max 50 |
51 | Metric 52 |
53 | MetricDescriptor 54 |
55 | MetricsPlugin 56 |
57 | MetricsPreferenceInitializer 58 |
59 | Sum
62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/core/sources/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.core.sources 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.core.sources 20 | 21 | 22 | 27 | 28 |
23 | Interfaces  24 | 25 |
26 | IGraphContributor
29 | 30 | 31 | 32 | 33 | 54 | 55 |
34 | Classes  35 | 36 |
37 | AbstractMetricSource 38 |
39 | Cache 40 |
41 | CompilationUnitMetrics 42 |
43 | Dispatcher 44 |
45 | MethodMetrics 46 |
47 | PackageFragmentMetrics 48 |
49 | PackageFragmentRootMetrics 50 |
51 | ProjectMetrics 52 |
53 | TypeMetrics
56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/internal/tests/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.internal.tests 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.internal.tests 20 | 21 | 22 | 31 | 32 |
23 | Classes  24 | 25 |
26 | AllTests 27 |
28 | AvgTests 29 |
30 | MaxTests
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/internal/xml/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.internal.xml 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.internal.xml 20 | 21 | 22 | 27 | 28 |
23 | Interfaces  24 | 25 |
26 | IXMLExporter
29 | 30 | 31 | 32 | 33 | 58 | 59 |
34 | Classes  35 | 36 |
37 | CompilationUnitXMLExporter 38 |
39 | MethodXMLExporter 40 |
41 | MetricsExporter 42 |
43 | MetricsFirstExporter 44 |
45 | MetricsFirstExporter.SoftCache 46 |
47 | PackageFragmentXMLExporter 48 |
49 | PackageRootXMLExporter 50 |
51 | ProjectXMLExporter 52 |
53 | TypeXMLExporter 54 |
55 | XMLPrintStream 56 |
57 | XMLSourceTreeExporter
60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/propagators/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.propagators 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.propagators 20 | 21 | 22 | 37 | 38 |
23 | Classes  24 | 25 |
26 | AvgAvg 27 |
28 | AvgValue 29 |
30 | MaxMax 31 |
32 | MaxValue 33 |
34 | Propagator 35 |
36 | Sum
39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/properties/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.properties 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.properties 20 | 21 | 22 | 29 | 30 |
23 | Classes  24 | 25 |
26 | ExclusionPatternDialog 27 |
28 | MetricsPropertyPage
31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/ui/dependencies/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.ui.dependencies 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.ui.dependencies 20 | 21 | 22 | 53 | 54 |
23 | Classes  24 | 25 |
26 | DependencyGraphPanel 27 |
28 | EclipseNode 29 |
30 | Knot 31 |
32 | PackageAttributes 33 |
34 | PathFinder 35 |
36 | PathFinder.Queue 37 |
38 | PathFinderDialog 39 |
40 | PathFinderDialog.VertexLabelProvider 41 |
42 | PathFinderDialog.VertexSorter 43 |
44 | TangleAnalyzer 45 |
46 | TopoSort 47 |
48 | TopoSortDialog 49 |
50 | TopoSortDialog.VertexLabelProvider 51 |
52 | TopoSortDialog.VertexSorter
55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/ui/layeredpackagegraph/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.ui.layeredpackagegraph 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.ui.layeredpackagegraph 20 | 21 | 22 | 39 | 40 |
23 | Classes  24 | 25 |
26 | LayeredPackageGraphActionGroup 27 |
28 | LayeredPackageGraphPanel 29 |
30 | LayeredPackageGraphView 31 |
32 | LayeredPackageTable 33 |
34 | LayeredPackageTableView 35 |
36 | LayeredTGLayout 37 |
38 | PackageStats
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/ui/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.ui 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.ui 20 | 21 | 22 | 39 | 40 |
23 | Classes  24 | 25 |
26 | AbortMetrics 27 |
28 | DependencyGraphView 29 |
30 | EnableMetrics 31 |
32 | MetricsActionGroup 33 |
34 | MetricsTable 35 |
36 | MetricsView 37 |
38 | OpenMetricsViewAction
41 | 42 | 43 | 44 | 45 | 50 | 51 |
46 | Exceptions  47 | 48 |
49 | EnableMetrics.MetricsNatureException
52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/net/sourceforge/metrics/ui/preferences/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net.sourceforge.metrics.ui.preferences 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | net.sourceforge.metrics.ui.preferences 20 | 21 | 22 | 39 | 40 |
23 | Classes  24 | 25 |
26 | ColorPreferencePage 27 |
28 | LCOMPreferencePage 29 |
30 | ListUpDownEditor 31 |
32 | MetricsPreferencePage 33 |
34 | NORMPreferencePage 35 |
36 | RangePage 37 |
38 | XMLExportPage
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Overview 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 |
22 |
25 | 26 | 27 | 28 | 58 | 59 |
All Classes 29 |

30 | 31 | Packages 32 |
33 | net.sourceforge.metrics.builder 34 |
35 | net.sourceforge.metrics.calculators 36 |
37 | net.sourceforge.metrics.core 38 |
39 | net.sourceforge.metrics.core.sources 40 |
41 | net.sourceforge.metrics.internal.tests 42 |
43 | net.sourceforge.metrics.internal.xml 44 |
45 | net.sourceforge.metrics.propagators 46 |
47 | net.sourceforge.metrics.properties 48 |
49 | net.sourceforge.metrics.ui 50 |
51 | net.sourceforge.metrics.ui.dependencies 52 |
53 | net.sourceforge.metrics.ui.layeredpackagegraph 54 |
55 | net.sourceforge.metrics.ui.preferences 56 |
57 |

60 | 61 |

62 |   63 | 64 | 65 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/package-list: -------------------------------------------------------------------------------- 1 | net.sourceforge.metrics.builder 2 | net.sourceforge.metrics.calculators 3 | net.sourceforge.metrics.core 4 | net.sourceforge.metrics.core.sources 5 | net.sourceforge.metrics.internal.tests 6 | net.sourceforge.metrics.internal.xml 7 | net.sourceforge.metrics.propagators 8 | net.sourceforge.metrics.properties 9 | net.sourceforge.metrics.ui 10 | net.sourceforge.metrics.ui.dependencies 11 | net.sourceforge.metrics.ui.layeredpackagegraph 12 | net.sourceforge.metrics.ui.preferences 13 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/packages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |
21 | 22 |
23 |

24 | The front page has been relocated.Please see: 25 |
26 |           Frame version 27 |
28 |           Non-frame version.
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/resources/inherit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/apidocs/resources/inherit.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/apidocs/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | 3 | /* Define colors, fonts and other style attributes here to override the defaults */ 4 | 5 | /* Page background color */ 6 | body { background-color: #FFFFFF } 7 | 8 | /* Headings */ 9 | h1 { font-size: 145% } 10 | 11 | /* Table colors */ 12 | .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ 13 | .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ 14 | .TableRowColor { background: #FFFFFF } /* White */ 15 | 16 | /* Font used in left-hand frame lists */ 17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif } 18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } 19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } 20 | 21 | /* Navigation bar fonts and colors */ 22 | .NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ 23 | .NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ 24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} 25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} 26 | 27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} 28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} 29 | 30 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/colors.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/colors.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/export.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/export.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/henderson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/henderson.jpg -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/lcom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/lcom.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/martin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/martin.jpg -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/norm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/norm.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/package_dependencies.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/package_dependencies.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/package_tangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/package_tangle.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/preferences.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/preferences.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/ranges.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/ranges.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/shortest_path.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/shortest_path.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/showview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/showview.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/tangle_details.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/tangle_details.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/doc/view.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/doc/view.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/abort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/abort.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/export_xml.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/export_xml.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/gview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/gview.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/mview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/mview.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/pause.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/pause.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/icons/resume.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/icons/resume.gif -------------------------------------------------------------------------------- /net.sourceforge.metrics/jdbm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/jdbm.jar -------------------------------------------------------------------------------- /net.sourceforge.metrics/schema/metrics-first-flat.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/builder/IMetricsProgressListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $Id: IMetricsProgressListener.java,v 1.4 2003/07/03 04:05:10 sauerf Exp $ 20 | */ 21 | 22 | package net.sourceforge.metrics.builder; 23 | 24 | import org.eclipse.core.runtime.IPath; 25 | import org.eclipse.jdt.core.IJavaElement; 26 | import org.eclipse.jdt.core.IJavaProject; 27 | 28 | public interface IMetricsProgressListener { 29 | /** 30 | * announces that an element has moved 31 | * 32 | * @param handle 33 | * new handle 34 | * @param fromPath 35 | * old location 36 | */ 37 | public void moved(IJavaElement element, IPath fromPath); 38 | 39 | /** 40 | * announces that count new elements are queued for calculation 41 | * 42 | * @param count 43 | */ 44 | public void queued(int count); 45 | 46 | /** 47 | * announces the currently calculating element 48 | * 49 | * @param current 50 | */ 51 | public void pending(IJavaElement element); 52 | 53 | /** 54 | * announces that the calculation for the element has completed 55 | * 56 | * @param handle 57 | * @param data 58 | */ 59 | public void completed(IJavaElement element, Object data); 60 | 61 | /** 62 | * announces that the currently calculating project is complete 63 | */ 64 | public void projectComplete(IJavaProject project, boolean aborted); 65 | 66 | /** 67 | * announces that the calculations are temporarily paused 68 | */ 69 | public void paused(); 70 | 71 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/builder/ProgressQueueCommand.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.builder; 2 | 3 | abstract class ProgressQueueCommand { 4 | 5 | public ProgressQueueCommand() { 6 | } 7 | 8 | abstract void execute(); 9 | 10 | boolean isResume() { 11 | return false; 12 | } 13 | 14 | boolean isPause() { 15 | return false; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/builder/Semaphore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $Id: Semaphore.java,v 1.3 2003/06/11 13:23:36 sauerf Exp $ 20 | */ 21 | package net.sourceforge.metrics.builder; 22 | 23 | /** 24 | * Simple counting semaphore for queue blocking 25 | * 26 | * @author Frank Sauer 27 | */ 28 | public class Semaphore { 29 | private int count = 0; 30 | private int initial = 0; 31 | 32 | public Semaphore(int initialCount) { 33 | count = initialCount; 34 | initial = initialCount; 35 | } 36 | 37 | public synchronized void P() throws InterruptedException { 38 | while (count <= 0) { 39 | wait(); 40 | } 41 | count--; 42 | } 43 | 44 | public synchronized void V() { 45 | ++count; 46 | notify(); 47 | } 48 | 49 | public synchronized void reset() { 50 | count = initial; 51 | } 52 | 53 | public synchronized void reset(int value) { 54 | count = value; 55 | } 56 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/Calculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | import net.sourceforge.metrics.core.CalculatorDescriptor; 24 | import net.sourceforge.metrics.core.Constants; 25 | import net.sourceforge.metrics.core.ICalculator; 26 | import net.sourceforge.metrics.core.Metric; 27 | import net.sourceforge.metrics.core.MetricsPlugin; 28 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 29 | 30 | import org.eclipse.jface.preference.IPreferenceStore; 31 | 32 | /** 33 | * Abstract base class for all metrics calculators. Real calculators must implement the calculate method and a no argument default constructor. 34 | * 35 | * @author Frank Sauer 36 | */ 37 | public abstract class Calculator implements Constants, ICalculator { 38 | 39 | protected String name; 40 | private CalculatorDescriptor descriptor = null; 41 | 42 | /** 43 | * Constructor for Calculator. 44 | */ 45 | public Calculator(String name) { 46 | super(); 47 | this.name = name; 48 | } 49 | 50 | public void setDescriptor(CalculatorDescriptor d) { 51 | descriptor = d; 52 | } 53 | 54 | public CalculatorDescriptor getDescriptor() { 55 | return descriptor; 56 | } 57 | 58 | protected Metric getZero() { 59 | return new Metric(getName(), 0); 60 | } 61 | 62 | /** 63 | * Returns the name. 64 | * 65 | * @return String 66 | */ 67 | public String getName() { 68 | return name; 69 | } 70 | 71 | /** 72 | * Sets the name. 73 | * 74 | * @param name 75 | * The name to set 76 | */ 77 | public void setName(String name) { 78 | this.name = name; 79 | } 80 | 81 | /** 82 | * @param source 83 | */ 84 | public abstract void calculate(AbstractMetricSource source) throws InvalidSourceException; 85 | 86 | /** 87 | * calculate fraction but return 0 if denominator is 0 instead of infinity or NaN 88 | * 89 | * @param num 90 | * numerator 91 | * @param den 92 | * denominator 93 | * @return double 94 | */ 95 | protected double div(double num, double den) { 96 | if (den == 0) { 97 | return 0; 98 | } 99 | return num / den; 100 | } 101 | 102 | protected static IPreferenceStore getPreferences() { 103 | return MetricsPlugin.getDefault().getPreferenceStore(); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/InheritanceDepth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * 20 | * $Id: InheritanceDepth.java,v 1.11 2004/04/30 19:49:17 sauerf Exp $ 21 | */ 22 | package net.sourceforge.metrics.calculators; 23 | 24 | import net.sourceforge.metrics.core.Constants; 25 | import net.sourceforge.metrics.core.Metric; 26 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 27 | import net.sourceforge.metrics.core.sources.TypeMetrics; 28 | 29 | import org.eclipse.jdt.core.IType; 30 | import org.eclipse.jdt.core.ITypeHierarchy; 31 | 32 | /** 33 | * Calculates Depth of Inheritance Tree, Number of Children and sets superclasses to either 0 or 1 (if the source has subclasses) 34 | * 35 | * @author Frank Sauer 36 | */ 37 | public class InheritanceDepth extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for Dit. 41 | */ 42 | public InheritanceDepth() { 43 | super(INHERITANCE_DEPTH); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != TYPE) { 52 | throw new InvalidSourceException("InheritanceDepth only applicable to types"); 53 | } 54 | TypeMetrics tm = (TypeMetrics) source; 55 | IType iType = (IType) source.getJavaElement(); 56 | ITypeHierarchy hierarchy = tm.getHierarchy(); 57 | IType[] supers = hierarchy.getAllSuperclasses(iType); 58 | IType[] subs = hierarchy.getSubtypes(iType); // BUG #933209 59 | source.setValue(new Metric(INHERITANCE_DEPTH, supers.length)); 60 | source.setValue(new Metric(SUBCLASSES, subs.length)); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/InvalidSourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | /** 24 | * thrown by a Calculator if it is not applicable for the given source 25 | * 26 | * @author Frank Sauer 27 | */ 28 | public class InvalidSourceException extends Exception { 29 | 30 | private static final long serialVersionUID = -7545786773692682861L; 31 | 32 | /** 33 | * Constructor for InvalidSourceException. 34 | */ 35 | public InvalidSourceException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructor for InvalidSourceException. 41 | * 42 | * @param s 43 | */ 44 | public InvalidSourceException(String s) { 45 | super(s); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/MethodLinesOfCode.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.calculators; 2 | 3 | import net.sourceforge.metrics.core.Constants; 4 | 5 | /** 6 | * Calculates MLOC: Method Lines of Code 7 | * 8 | * @author Guillaume Boissier 9 | * @since 1.3.6 10 | */ 11 | public class MethodLinesOfCode extends AbstractLinesOfCode { 12 | 13 | public MethodLinesOfCode() { 14 | super(Constants.MLOC); 15 | } 16 | 17 | @Override 18 | protected void checkLevelOfComputation(int a_level) throws InvalidSourceException { 19 | // TODO do we realy need to do some check ? 20 | } 21 | 22 | /** 23 | * filter out everything outside of the method body 24 | */ 25 | @Override 26 | protected String filterSourceToProcess(String a_source) { 27 | String l_return; 28 | int l_indexOfMethodBodyStart = a_source.indexOf('{'); 29 | int l_indexOfMethodBodyEnd = a_source.lastIndexOf('}'); 30 | if (l_indexOfMethodBodyStart != -1 && l_indexOfMethodBodyEnd != -1) { 31 | l_return = a_source.substring(l_indexOfMethodBodyStart + 1, l_indexOfMethodBodyEnd).trim(); 32 | } else { 33 | l_return = EMPTY_STRING; 34 | } 35 | 36 | return l_return; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/NestedBlockDepth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.Metric; 25 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 26 | 27 | import org.eclipse.jdt.core.dom.ASTVisitor; 28 | import org.eclipse.jdt.core.dom.Block; 29 | import org.eclipse.jdt.core.dom.MethodDeclaration; 30 | 31 | /** 32 | * Calculate max nested block depth for a method 33 | * 34 | * @author Frank Sauer 35 | */ 36 | public class NestedBlockDepth extends Calculator implements Constants { 37 | 38 | /** 39 | * Constructor for NestedBlockDepth. 40 | */ 41 | public NestedBlockDepth() { 42 | super(NESTEDBLOCKDEPTH); 43 | } 44 | 45 | /** 46 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 47 | */ 48 | @Override 49 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 50 | if (source.getLevel() != METHOD) { 51 | throw new InvalidSourceException("NestedBlockDepth only applicable to methods"); 52 | } 53 | MethodDeclaration astNode = (MethodDeclaration) source.getASTNode(); 54 | if (astNode == null) { 55 | source.setValue(getZero()); 56 | } 57 | Block body = astNode.getBody(); 58 | if (body == null) { 59 | source.setValue(getZero()); 60 | } 61 | LevelCounter lc = new LevelCounter(); 62 | astNode.accept(lc); 63 | source.setValue(new Metric(getName(), lc.maxDepth)); 64 | } 65 | 66 | /** 67 | * counts the maximum block depth by visiting Blocks 68 | */ 69 | private class LevelCounter extends ASTVisitor { 70 | 71 | int maxDepth = 0; 72 | int depth = 0; 73 | 74 | @Override 75 | public boolean visit(Block node) { 76 | depth++; 77 | return true; 78 | } 79 | 80 | @Override 81 | public void endVisit(Block node) { 82 | if (depth > maxDepth) { 83 | maxDepth = depth; 84 | } 85 | depth--; 86 | } 87 | 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/NumberOfParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.Metric; 25 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 26 | 27 | import org.eclipse.jdt.core.dom.MethodDeclaration; 28 | 29 | /** 30 | * Counts the number of parameters for a method 31 | * 32 | * @author Frank Sauer 33 | * 34 | */ 35 | public class NumberOfParameters extends Calculator implements Constants { 36 | 37 | /** 38 | * Constructor for NumberOfParameters. 39 | */ 40 | public NumberOfParameters() { 41 | super(PARMS); 42 | } 43 | 44 | /** 45 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 46 | */ 47 | @Override 48 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 49 | if (source.getLevel() != METHOD) { 50 | throw new InvalidSourceException("NumberOfParameters only applicable to methods"); 51 | } 52 | MethodDeclaration astNode = (MethodDeclaration) source.getASTNode(); 53 | source.setValue(new Metric(PARMS, astNode.parameters().size())); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/SpecializationIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.Metric; 25 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 26 | 27 | /** 28 | * Calculates the SI (NORM * DIT) / NOM. Note that because NORM is configurable from preferences, the value of SI is indirectly influenced by preferences as well. 29 | * 30 | * @author Frank Sauer 31 | */ 32 | public class SpecializationIndex extends Calculator implements Constants { 33 | 34 | /** 35 | * Constructor for SpecializationIndex. 36 | */ 37 | public SpecializationIndex() { 38 | super(SPECIALIZATION_IN); 39 | } 40 | 41 | /** 42 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 43 | */ 44 | @Override 45 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 46 | if (source.getLevel() != TYPE) { 47 | throw new InvalidSourceException("SpecializationIndex only applicable to types"); 48 | } 49 | double norm = source.getValue(NORM).doubleValue(); 50 | double dit = source.getValue(INHERITANCE_DEPTH).doubleValue(); 51 | double nom = source.getValue(NUM_METHODS).doubleValue(); 52 | source.setValue(new Metric(SPECIALIZATION_IN, div(norm * dit, nom))); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/SpecializationIndex2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.Metric; 25 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 26 | 27 | /** 28 | * Calculates the SI (NORM * DIT) / NOM. Note that because NORM is configurable from preferences, the value of SI is indirectly influenced by preferences as well. 29 | * 30 | * @author Frank Sauer 31 | */ 32 | public class SpecializationIndex2 extends Calculator implements Constants { 33 | 34 | /** 35 | * Constructor for SpecializationIndex. 36 | */ 37 | public SpecializationIndex2() { 38 | super(SPECIALIZATION_IN2); 39 | } 40 | 41 | /** 42 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 43 | */ 44 | @Override 45 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 46 | if (source.getLevel() != TYPE) { 47 | throw new InvalidSourceException("SpecializationIndex only applicable to types"); 48 | } 49 | double norm = source.getValue(NORM).doubleValue(); 50 | double dit = source.getValue(INHERITANCE_DEPTH).doubleValue(); 51 | double nom = source.getValue(NUM_METHODS).doubleValue(); 52 | double nim = source.getValue(NUM_INHERITED_METHODS).doubleValue(); 53 | source.setValue(new Metric(SPECIALIZATION_IN2, div(norm * dit, (nom + nim)))); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/TotalLinesOfCode.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.calculators; 2 | 3 | import net.sourceforge.metrics.core.Constants; 4 | 5 | /** 6 | * Calculates TLOC: Total Lines of Code 7 | * 8 | * @author Guillaume Boissier 9 | * @since 1.3.6 10 | */ 11 | public class TotalLinesOfCode extends AbstractLinesOfCode { 12 | 13 | public TotalLinesOfCode() { 14 | super(Constants.TLOC); 15 | } 16 | 17 | @Override 18 | protected void checkLevelOfComputation(int a_level) throws InvalidSourceException { 19 | // TODO do we realy need to do some check ? 20 | } 21 | 22 | /** 23 | * Use everything 24 | */ 25 | @Override 26 | protected String filterSourceToProcess(String a_source) { 27 | return a_source; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/package.html: -------------------------------------------------------------------------------- 1 | 2 | Contains the core calculators implementing the <calculator> extension 3 | 4 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/AverageNumberOfAncestors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the ANA metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class AverageNumberOfAncestors extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for ANA. 41 | */ 42 | public AverageNumberOfAncestors() { 43 | super(ANA); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("AverageNumberOfAncestors is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | source.setValue(new Metric(ANA,averages.get("typeDIT").getValue())); 57 | 58 | } catch (Exception e) { 59 | source.setValue(new Metric(ANA, 0)); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/CohesionAmongMethodsOfClass.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/CohesionAmongMethodsOfClass.java -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/DirectClassCoupling.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.HashSet; 24 | import java.util.Set; 25 | 26 | import net.sourceforge.metrics.calculators.Calculator; 27 | import net.sourceforge.metrics.calculators.InvalidSourceException; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.MetricsUtils; 31 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 32 | 33 | import org.eclipse.jdt.core.dom.FieldDeclaration; 34 | import org.eclipse.jdt.core.dom.ITypeBinding; 35 | import org.eclipse.jdt.core.dom.MethodDeclaration; 36 | import org.eclipse.jdt.core.dom.TypeDeclaration; 37 | 38 | /** 39 | * A count of the different number of classes that a class is directly related to. 40 | * The metric includes classes that are directly related by attribute declaration and message passing 41 | * (parameters) in methods. Interpreted as an average over all classes when applied to a design as 42 | * a whole; a count of the number of distinct user-defined classes a class is coupled to by method 43 | * parameter or attribute type. *Definição de Cinnéide* 44 | * 45 | * @author Leonardo Jr. 46 | */ 47 | public class DirectClassCoupling extends Calculator implements Constants { 48 | 49 | /** 50 | * Constructor for DCC. 51 | */ 52 | public DirectClassCoupling() { 53 | super(DCC); 54 | } 55 | 56 | /** 57 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 58 | */ 59 | @Override 60 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 61 | if (source.getLevel() != TYPE) { 62 | throw new InvalidSourceException("DirectClassCoupling is only applicable to types"); 63 | } 64 | Set tipos = new HashSet(); 65 | if(source.getASTNode() instanceof TypeDeclaration){ 66 | TypeDeclaration type = (TypeDeclaration)source.getASTNode(); 67 | FieldDeclaration[] fields = type.getFields(); 68 | MethodDeclaration[] methods = type.getMethods(); 69 | for (FieldDeclaration field : fields) 70 | tipos.addAll(MetricsUtils.getSourceTypeNames(field.getType().resolveBinding())); 71 | for (MethodDeclaration method : methods) 72 | for (ITypeBinding binding : method.resolveBinding().getParameterTypes()) 73 | tipos.addAll(MetricsUtils.getSourceTypeNames(binding)); 74 | 75 | } 76 | source.setValue(new Metric(DCC,tipos.size())); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Effectiveness.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Effectiveness metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class Effectiveness extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for EFE. 41 | */ 42 | public Effectiveness() { 43 | super(EFE); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("Effectiveness is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | double valor = 0.2*source.getValue(Metric.ANA).getValue() 57 | + 0.2*averages.get("typeDAM").getValue() 58 | + 0.2*averages.get("typeMOA").getValue() 59 | + 0.2*averages.get("typeMFA").getValue() 60 | + 0.2*averages.get("typeNOPM").getValue(); 61 | source.setValue(new Metric(EFE,valor)); 62 | } catch (Exception e) { 63 | source.setValue(new Metric(EFE, 0)); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Extendibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Extendibility metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class Extendibility extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for EXT. 41 | */ 42 | public Extendibility() { 43 | super(EXT); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("Extendibility is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | double valor = 0.5*source.getValue(Metric.ANA).getValue() 57 | - 0.5*averages.get("typeDCC").getValue() 58 | + 0.5*averages.get("typeMFA").getValue() 59 | + 0.5*averages.get("typeNOPM").getValue(); 60 | source.setValue(new Metric(EXT,valor)); 61 | } catch (Exception e) { 62 | source.setValue(new Metric(EXT, 0)); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Flexibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Flexibility metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class Flexibility extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for FLE. 41 | */ 42 | public Flexibility() { 43 | super(FLE); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("Flexibilidade is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | double valor = 0.25*averages.get("typeDAM").getValue() 57 | - 0.25*averages.get("typeDCC").getValue() 58 | + 0.50*averages.get("typeMOA").getValue() 59 | + 0.50*averages.get("typeNOPM").getValue(); 60 | source.setValue(new Metric(FLE,valor)); 61 | } catch (Exception e) { 62 | source.setValue(new Metric(FLE, 0)); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Functionality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Functionality metric - QMOOD 34 | * @author Leonardo Jr. 35 | */ 36 | public class Functionality extends Calculator implements Constants { 37 | 38 | /** 39 | * Constructor for FLE. 40 | */ 41 | public Functionality() { 42 | super(FUN); 43 | } 44 | 45 | /** 46 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 47 | */ 48 | @Override 49 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 50 | if (source.getLevel() != PROJECT) { 51 | throw new InvalidSourceException("Functionality is only applicable to projects"); 52 | } 53 | try { 54 | Map averages = source.getAverages(); 55 | double valor = 0.12*averages.get("typeCAM").getValue() 56 | - 0.22*averages.get("typeNOPM").getValue() 57 | + 0.22*averages.get("typeCIS").getValue() 58 | + 0.22*source.getValue(Metric.DSC).getValue() 59 | + 0.22*source.getValue(Metric.NOH).getValue(); 60 | //+ 0.22*averages.get("typeNOH").getValue(); 61 | source.setValue(new Metric(FUN,valor)); 62 | } catch (Exception e) { 63 | source.setValue(new Metric(FUN, 0)); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/NumberOfHierarchies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * 20 | * $Id: InheritanceDepth.java,v 1.11 2004/04/30 19:49:17 sauerf Exp $ 21 | */ 22 | package net.sourceforge.metrics.calculators.qmood; 23 | 24 | import net.sourceforge.metrics.calculators.Calculator; 25 | import net.sourceforge.metrics.calculators.InvalidSourceException; 26 | import net.sourceforge.metrics.core.Constants; 27 | import net.sourceforge.metrics.core.Metric; 28 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 29 | import net.sourceforge.metrics.core.sources.TypeMetrics; 30 | 31 | import org.eclipse.jdt.core.IType; 32 | import org.eclipse.jdt.core.ITypeHierarchy; 33 | 34 | /** 35 | * Calculates if this type is the root of a hierarchic tree, and receives NOH = 1. Otherwise NOH = 0. 36 | * At an upper level, the propagated sum calculates the number of hiearchies on the software. 37 | * 38 | * @author Leonardo Jr. 39 | */ 40 | public class NumberOfHierarchies extends Calculator implements Constants { 41 | 42 | /** 43 | * Constructor for NOH. 44 | */ 45 | public NumberOfHierarchies() { 46 | super(NOH); 47 | } 48 | 49 | /** 50 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 51 | */ 52 | @Override 53 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 54 | if (source.getLevel() != TYPE) { 55 | throw new InvalidSourceException("NumberOfHierarchies only applicable to types"); 56 | } 57 | TypeMetrics tm = (TypeMetrics) source; 58 | IType iType = (IType) source.getJavaElement(); 59 | ITypeHierarchy hierarchy = tm.getHierarchy(); 60 | IType[] supers = hierarchy.getAllSuperclasses(iType); 61 | int numSourceSupers = 0; 62 | for (IType type : supers) { 63 | if(!type.isBinary()) 64 | numSourceSupers++; 65 | } 66 | int numSubSources = 0; 67 | IType[] subs = hierarchy.getSubtypes(iType); // BUG #933209 68 | for (IType type : subs) { 69 | if(!type.isBinary()) 70 | numSubSources++; 71 | } 72 | //If the type has no source supers and any subclasses, it's considered a root. 73 | if(numSourceSupers==0 && numSubSources>0) 74 | source.setValue(new Metric(NOH,1)); 75 | else source.setValue(new Metric(NOH,0)); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/NumberOfNormalMethods.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.ArrayList; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Constants; 28 | import net.sourceforge.metrics.core.Metric; 29 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 30 | 31 | import org.eclipse.jdt.core.IField; 32 | import org.eclipse.jdt.core.IMethod; 33 | import org.eclipse.jdt.core.IType; 34 | import org.eclipse.jdt.core.JavaModelException; 35 | import org.eclipse.jdt.internal.corext.codemanipulation.GetterSetterUtil; 36 | import org.eclipse.jdt.internal.corext.util.JdtFlags; 37 | 38 | /** 39 | * Counts the number of instance class methods, excluding getters and setters. Those are identified using the Eclipse api 40 | * for getter and setter generation which respect the JavaBean nomenclature conventions. 41 | * 42 | * @author Leonardo Jr. 43 | */ 44 | @SuppressWarnings("restriction") 45 | public class NumberOfNormalMethods extends Calculator implements Constants { 46 | 47 | /** 48 | * Constructor for NumberOfMethods. 49 | */ 50 | public NumberOfNormalMethods() { 51 | super(NUM_NORMAL_METHODS); 52 | } 53 | 54 | /** 55 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 56 | */ 57 | @Override 58 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 59 | if (source.getLevel() != TYPE) { 60 | throw new InvalidSourceException("NumberOfNormalMethods is only applicable to types"); 61 | } 62 | try { 63 | IType type = ((IType) source.getJavaElement()); 64 | IMethod[] methods = type.getMethods(); 65 | IField[] fields = type.getFields(); 66 | ArrayList gettersAndSetters = new ArrayList(); 67 | int numNormalMethods=0; 68 | 69 | for(IField field:fields){ 70 | IMethod getter = GetterSetterUtil.getGetter(field); 71 | IMethod setter = GetterSetterUtil.getSetter(field); 72 | if(getter!=null) 73 | gettersAndSetters.add(getter); 74 | if(setter!=null) 75 | gettersAndSetters.add(setter); 76 | } 77 | 78 | for (IMethod method : methods) { 79 | if(!gettersAndSetters.contains(method) && !JdtFlags.isStatic(method)) 80 | numNormalMethods++; 81 | } 82 | source.setValue(new Metric(NUM_NORMAL_METHODS, numNormalMethods)); 83 | } catch (JavaModelException e) { 84 | source.setValue(new Metric(NUM_NORMAL_METHODS, 0)); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Reusability.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Reusability metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class Reusability extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for REU. 41 | */ 42 | public Reusability() { 43 | super(REU); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("Reusability is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | double valor = 57 | - 0.25*averages.get("typeDCC").getValue() 58 | + 0.25*averages.get("typeCAM").getValue() 59 | + 0.50*averages.get("typeCIS").getValue() 60 | + 0.50*source.getValue(Metric.DSC).getValue(); 61 | source.setValue(new Metric(REU,valor)); 62 | } catch (Exception e) { 63 | source.setValue(new Metric(REU, 0)); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/calculators/qmood/Understandability.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.calculators.qmood; 22 | 23 | import java.util.Map; 24 | 25 | import net.sourceforge.metrics.calculators.Calculator; 26 | import net.sourceforge.metrics.calculators.InvalidSourceException; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Constants; 29 | import net.sourceforge.metrics.core.Metric; 30 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 31 | 32 | /** 33 | * Calculator for the Effectiveness Metric - QMOOD 34 | * 35 | * @author Leonardo Jr. 36 | */ 37 | public class Understandability extends Calculator implements Constants { 38 | 39 | /** 40 | * Constructor for ENT. 41 | */ 42 | public Understandability() { 43 | super(UND); 44 | } 45 | 46 | /** 47 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 48 | */ 49 | @Override 50 | public void calculate(AbstractMetricSource source) throws InvalidSourceException { 51 | if (source.getLevel() != PROJECT) { 52 | throw new InvalidSourceException("Effectiveness is only applicable to projects"); 53 | } 54 | try { 55 | Map averages = source.getAverages(); 56 | double valor = 57 | -0.33*source.getValue(Metric.ANA).getValue() 58 | +0.33*averages.get("typeDAM").getValue() 59 | -0.33*averages.get("typeDCC").getValue() 60 | +0.33*averages.get("typeCAM").getValue() 61 | -0.33*averages.get("typeNOPM").getValue() 62 | -0.33*averages.get("typeNONM").getValue() 63 | -0.33*source.getValue(Metric.DSC).getValue(); 64 | source.setValue(new Metric(UND,valor)); 65 | } catch (Exception e) { 66 | source.setValue(new Metric(UND, 0)); 67 | } 68 | } 69 | 70 | @Override 71 | public String toString() { 72 | return UND; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/ICalculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * created on Jan 13, 2003 20 | */ 21 | package net.sourceforge.metrics.core; 22 | 23 | import net.sourceforge.metrics.calculators.InvalidSourceException; 24 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 25 | 26 | /** 27 | * Public interface all calculators must implement. 28 | * 29 | * @author Frank Sauer 30 | * @see net.sourceforge.metrics.calculators.Calculator 31 | */ 32 | public interface ICalculator { 33 | String getName(); 34 | 35 | void setName(String name); 36 | 37 | void calculate(AbstractMetricSource source) throws InvalidSourceException; 38 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/IExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.core; 22 | 23 | import java.io.File; 24 | import java.lang.reflect.InvocationTargetException; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | import org.eclipse.jdt.core.IJavaElement; 28 | 29 | /** 30 | * interface used by classes specified in exporter extension points 31 | * 32 | * @author Frank Sauer 33 | */ 34 | public interface IExporter { 35 | 36 | /** 37 | * 38 | * @param element 39 | * selected IJavaElement in the MetricsView 40 | * @param outputFile 41 | * result of the Save Dialog file selection 42 | * @param monitor 43 | * progress monitor 44 | * @throws InvocationTargetException 45 | */ 46 | public abstract void export(IJavaElement element, File outputFile, IProgressMonitor monitor) throws InvocationTargetException; 47 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on May 13, 2003 3 | * 4 | * To change the template for this generated file go to 5 | * Window>Preferences>Java>Code Generation>Code and Comments 6 | */ 7 | package net.sourceforge.metrics.core; 8 | 9 | import org.eclipse.core.runtime.IStatus; 10 | import org.eclipse.core.runtime.Status; 11 | 12 | /** 13 | * Separating this from the MetricsPlugin class breaks numerous cyclic dependencies 14 | * 15 | * @author Frank Sauer 16 | */ 17 | public class Log { 18 | 19 | public final static String PLUGIN_ID = "net.sourceforge.metrics"; 20 | 21 | public static void logError(String message, Throwable t) { 22 | MetricsPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, t)); 23 | } 24 | 25 | public static void logWarrning(String message, Throwable t) { 26 | MetricsPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.WARNING, message, t)); 27 | } 28 | 29 | public static void logMessage(String message) { 30 | MetricsPlugin.getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.INFO, message, null)); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/MetricsPreferenceInitializer.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.core; 2 | 3 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; 4 | import org.eclipse.jface.preference.IPreferenceStore; 5 | 6 | /** 7 | * To comply with Eclipse 3.0 API this class is needed to initialize the default values for the metrics preferences. It is references in the plugin.xml. 8 | * 9 | * @author Frank Sauer 10 | */ 11 | public class MetricsPreferenceInitializer extends AbstractPreferenceInitializer { 12 | 13 | /* 14 | * (non-Javadoc) 15 | * 16 | * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer# initializeDefaultPreferences() 17 | */ 18 | @Override 19 | public void initializeDefaultPreferences() { 20 | IPreferenceStore prefStore = MetricsPlugin.getDefault().getPreferenceStore(); 21 | prefStore.setDefault("METRICS.decimals", Constants.FRACTION_DIGITS); 22 | prefStore.setDefault("METRICS.xmlformat", "net.sourceforge.metrics.internal.xml.MetricsFirstExporter"); 23 | prefStore.setDefault("METRICS.enablewarnings", false); 24 | prefStore.setDefault("METRICS.defaultColor", "0,0,0"); 25 | prefStore.setDefault("METRICS.linkedColor", "0,0,255"); 26 | prefStore.setDefault("METRICS.outOfRangeColor", "255,0,0"); 27 | prefStore.setDefault("METRICS.depGR_background", "1,17,68"); 28 | prefStore.setDefault("METRICS.showProject", true); 29 | prefStore.addPropertyChangeListener(MetricsPlugin.getDefault()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/MetricsUtils.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.core; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import org.eclipse.jdt.core.dom.ArrayType; 7 | import org.eclipse.jdt.core.dom.FieldDeclaration; 8 | import org.eclipse.jdt.core.dom.ITypeBinding; 9 | import org.eclipse.jdt.core.dom.Type; 10 | 11 | public final class MetricsUtils { 12 | 13 | static public boolean isFieldFromSource(FieldDeclaration fd){ 14 | Type t = fd.getType(); 15 | if(t.isSimpleType()) 16 | return t.resolveBinding().isFromSource(); 17 | 18 | //A[] returns if A is from Source 19 | if(t.isArrayType()){ 20 | ArrayType at = (ArrayType)t; 21 | if(at.getElementType().isSimpleType() || at.getElementType().isQualifiedType()) 22 | return at.getElementType().resolveBinding().isFromSource(); 23 | } 24 | 25 | //T, T - true if A is from Source or if A or B are source types. 26 | //Collections with source as parameters are considered because represents a relationship with a source type 27 | if(t.isParameterizedType()){ 28 | ITypeBinding tb = t.resolveBinding(); 29 | ITypeBinding[] interfaces = tb.getInterfaces(); 30 | boolean isCollection = false; 31 | for (ITypeBinding iTypeBinding : interfaces) { 32 | isCollection = isCollection || iTypeBinding.getBinaryName().equals("java.util.Collection"); 33 | } 34 | if(isCollection){ 35 | for (ITypeBinding typeArg : tb.getTypeArguments()) { 36 | if(typeArg.isFromSource()) 37 | return true; 38 | } 39 | } 40 | } 41 | 42 | return false; 43 | } 44 | 45 | /** 46 | * Check if the type argument is a source one, and return all the ones involved. 47 | * In this particular approach, Arrays and Parameterized types are from source if they represent 48 | * @param type 49 | * @return 50 | */ 51 | static public Set getSourceTypeNames(ITypeBinding type){ 52 | Set nomes = new HashSet(); 53 | 54 | if(type.isFromSource()){ 55 | nomes.add(type.getQualifiedName()); 56 | } 57 | 58 | //A[] returns if A is from Source 59 | if(type.isArray() && type.getElementType().isFromSource()) 60 | nomes.add(type.getElementType().getQualifiedName()); 61 | 62 | //T, T - true if A is from Source or if A or B are source types and its a Collection 63 | //Collections with source as parameters are considered because represents a relationship with a source type 64 | if(type.isParameterizedType()){ 65 | ITypeBinding[] interfaces = type.getInterfaces(); 66 | boolean isCollection = false; 67 | for (ITypeBinding iTypeBinding : interfaces) { 68 | isCollection = isCollection || iTypeBinding.getBinaryName().equals("java.util.Collection"); 69 | } 70 | 71 | if(isCollection){ 72 | for (ITypeBinding typeArg : type.getTypeArguments()) { 73 | if(typeArg.isFromSource()) 74 | nomes.add(typeArg.getQualifiedName()); 75 | } 76 | } 77 | } 78 | //System.out.println(type.getQualifiedName()+"->"+nomes); 79 | return nomes; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/Sum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.core; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * Only needed to distinguish a pure metric from a propagated one 27 | * 28 | * @author Frank Sauer 29 | */ 30 | public class Sum extends Metric implements Serializable { 31 | 32 | private static final long serialVersionUID = -3763122480771575457L; 33 | boolean propagated = true; 34 | 35 | public Sum(String name, double value, boolean propagated) { 36 | this(name, value); 37 | this.propagated = propagated; 38 | } 39 | 40 | public Sum(String name, double value) { 41 | super(name, value); 42 | } 43 | 44 | @Override 45 | public boolean isPropagated() { 46 | return propagated; 47 | } 48 | 49 | /** 50 | * @param name 51 | * @param per 52 | * @param value 53 | */ 54 | public Sum(String name, String per, double value) { 55 | super(name, per, value); 56 | } 57 | 58 | /** 59 | * Sets the propagated. 60 | * 61 | * @param propagated 62 | * The propagated to set 63 | */ 64 | public void setPropagated(boolean propagated) { 65 | this.propagated = propagated; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/core/sources/IGraphContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */package net.sourceforge.metrics.core.sources; 21 | 22 | import java.util.Map; 23 | import java.util.Set; 24 | 25 | /** 26 | * @author Frank Sauer 27 | */ 28 | public interface IGraphContributor { 29 | 30 | Map> getEfferent(); 31 | } 32 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/CompilationUnitXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | import net.sourceforge.metrics.core.sources.TypeMetrics; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | 28 | /** 29 | * Export compilation unit metrics to an XML report 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class CompilationUnitXMLExporter extends MetricsExporter implements IXMLExporter { 34 | 35 | public CompilationUnitXMLExporter() { 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * 41 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 42 | */ 43 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 44 | printOpeningTag(source, out, level); 45 | printMetrics(source, out, level + 1); 46 | exportChildren(out, source.getHandle(), level + 1, TypeMetrics.class, monitor); 47 | printClosingTag(out, level); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see net.sourceforge.metrics.internal.xml.IExporter#getTagName() 54 | */ 55 | @Override 56 | public String getTagName() { 57 | return "CompilationUnit"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/IXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | 25 | import org.eclipse.core.runtime.IProgressMonitor; 26 | 27 | /** 28 | * @author Frank Sauer 29 | */ 30 | public interface IXMLExporter { 31 | 32 | static final IXMLExporter PROJECT_EXPORTER = new ProjectXMLExporter(); 33 | static final IXMLExporter PACKAGEROOT_EXPORTER = new PackageRootXMLExporter(); 34 | static final IXMLExporter PACKAGEFRAGMENT_EXPORTER = new PackageFragmentXMLExporter(); 35 | static final IXMLExporter COMPILATIONUNIT_EXPORTER = new CompilationUnitXMLExporter(); 36 | static final IXMLExporter TYPE_EXPORTER = new TypeXMLExporter(); 37 | static final IXMLExporter METHOD_EXPORTER = new MethodXMLExporter(); 38 | 39 | void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor); 40 | 41 | String getTagName(); 42 | } 43 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/MethodXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | 25 | import org.eclipse.core.runtime.IProgressMonitor; 26 | 27 | /** 28 | * Export method metrics to an XML report 29 | * 30 | * @author Frank Sauer 31 | */ 32 | public class MethodXMLExporter extends MetricsExporter implements IXMLExporter { 33 | 34 | public MethodXMLExporter() { 35 | } 36 | 37 | /* 38 | * (non-Javadoc) 39 | * 40 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 41 | */ 42 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 43 | printOpeningTag(source, out, level); 44 | printMetrics(source, out, level + 1); 45 | printClosingTag(out, level); 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * 51 | * @see net.sourceforge.metrics.internal.xml.MetricsExporter#getTagName() 52 | */ 53 | @Override 54 | public String getTagName() { 55 | return "Method"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/PackageFragmentXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | import net.sourceforge.metrics.core.sources.CompilationUnitMetrics; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | 28 | /** 29 | * Export package fragment metrics to an XML report 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class PackageFragmentXMLExporter extends MetricsExporter implements IXMLExporter { 34 | 35 | public PackageFragmentXMLExporter() { 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * 41 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 42 | */ 43 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 44 | printOpeningTag(source, out, level); 45 | printMetrics(source, out, level + 1); 46 | exportChildren(out, source.getHandle(), level + 1, CompilationUnitMetrics.class, monitor); 47 | printClosingTag(out, level); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see net.sourceforge.metrics.internal.xml.MetricsExporter#getTagName() 54 | */ 55 | @Override 56 | public String getTagName() { 57 | return "Package"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/PackageRootXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | import net.sourceforge.metrics.core.sources.PackageFragmentMetrics; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | 28 | /** 29 | * Export package root (source folder) metrics to an XML report 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class PackageRootXMLExporter extends MetricsExporter implements IXMLExporter { 34 | 35 | public PackageRootXMLExporter() { 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * 41 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 42 | */ 43 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 44 | printOpeningTag(source, out, level); 45 | printMetrics(source, out, level + 1); 46 | exportChildren(out, source.getHandle(), level + 1, PackageFragmentMetrics.class, monitor); 47 | printClosingTag(out, level); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see net.sourceforge.metrics.internal.xml.MetricsExporter#getTagName() 54 | */ 55 | @Override 56 | public String getTagName() { 57 | return "PackageRoot"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/ProjectXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | import net.sourceforge.metrics.core.sources.PackageFragmentRootMetrics; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | 28 | /** 29 | * Export project metrics to an XML report 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class ProjectXMLExporter extends MetricsExporter implements IXMLExporter { 34 | 35 | public ProjectXMLExporter() { 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * 41 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 42 | */ 43 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 44 | printOpeningTag(source, out, level); 45 | printMetrics(source, out, level + 1); 46 | exportChildren(out, source.getHandle(), level + 1, PackageFragmentRootMetrics.class, monitor); 47 | printClosingTag(out, level); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see net.sourceforge.metrics.internal.xml.MetricsExporter#getTagName() 54 | */ 55 | @Override 56 | public String getTagName() { 57 | return "Project"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/TypeXMLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 24 | import net.sourceforge.metrics.core.sources.MethodMetrics; 25 | 26 | import org.eclipse.core.runtime.IProgressMonitor; 27 | 28 | /** 29 | * Export type metrics to an XML report 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class TypeXMLExporter extends MetricsExporter implements IXMLExporter { 34 | 35 | public TypeXMLExporter() { 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * 41 | * @see net.sourceforge.metrics.export.xml.IExporter#export(net.sourceforge.metrics .core.sources.AbstractMetricSource, net.sourceforge.metrics.export.xml.XMLPrintStream, int) 42 | */ 43 | public void export(AbstractMetricSource source, XMLPrintStream out, int level, IProgressMonitor monitor) { 44 | printOpeningTag(source, out, level); 45 | printMetrics(source, out, level + 1); 46 | exportChildren(out, source.getHandle(), level + 1, MethodMetrics.class, monitor); 47 | printClosingTag(out, level); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see net.sourceforge.metrics.internal.xml.MetricsExporter#getTagName() 54 | */ 55 | @Override 56 | public String getTagName() { 57 | return "Type"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/WinCompliantExporter.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.internal.xml; 2 | 3 | public class WinCompliantExporter extends MetricsFirstExporter { 4 | 5 | @Override 6 | protected String formatXMLStr(String handle) { 7 | return handle.replaceAll("<", "[@").replaceAll(">", "@]").replaceAll("\\\\", "_"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/internal/xml/XMLPrintStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.xml; 22 | 23 | import java.io.OutputStream; 24 | import java.io.PrintStream; 25 | import java.text.SimpleDateFormat; 26 | import java.util.Date; 27 | 28 | /** 29 | * @author Frank Sauer 30 | */ 31 | public class XMLPrintStream extends PrintStream { 32 | 33 | public final static String XML = ""; 34 | private static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 35 | 36 | /** 37 | * @param out 38 | */ 39 | public XMLPrintStream(OutputStream out) { 40 | super(out); 41 | } 42 | 43 | public void printXMLHeader() { 44 | println(XML); 45 | } 46 | 47 | public void indent(int level) { 48 | if (level > 0) { 49 | StringBuffer b = new StringBuffer(""); 50 | for (int i = 0; i < level; i++) { 51 | b.append(" "); 52 | } 53 | print(b.toString()); 54 | } 55 | } 56 | 57 | public String formatXSDDate(Date d) { 58 | synchronized (df) { 59 | return df.format(d).toString(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/AvgAvg.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import java.util.List; 24 | 25 | import net.sourceforge.metrics.core.Avg; 26 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 27 | 28 | /** 29 | * Propagate an average value 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class AvgAvg extends Propagator { 34 | 35 | /** 36 | * Constructor for AvgAvg. 37 | * 38 | * @param name 39 | * @param per 40 | */ 41 | public AvgAvg(String name, String per) { 42 | super(name, per, name); 43 | } 44 | 45 | /** 46 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 47 | */ 48 | @Override 49 | public void calculate(AbstractMetricSource source) { 50 | if (source.getSize() == 0) { 51 | source.setAverage(new Avg(getName(), per, 0, 0, 0)); 52 | } 53 | List averages = source.getAveragesFromChildren(getName(), per); 54 | source.setAverage(Avg.createFromAverages(name, per, averages)); 55 | } 56 | 57 | /** 58 | * @see net.sourceforge.metrics.propagators.Propagator#createNextLevel() 59 | */ 60 | @Override 61 | public Propagator createNextLevel() { 62 | return this; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "AvgAvg(" + name + "," + per + ")"; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/AvgValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import java.util.List; 24 | 25 | import net.sourceforge.metrics.core.Avg; 26 | import net.sourceforge.metrics.core.Metric; 27 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 28 | 29 | /** 30 | * Calculate an average value 31 | * 32 | * @author Frank Sauer 33 | */ 34 | public class AvgValue extends Propagator { 35 | 36 | /** 37 | * Constructor for AvgValue. 38 | * 39 | * @param name 40 | */ 41 | public AvgValue(String name, String per) { 42 | super(name, per, name); 43 | } 44 | 45 | /** 46 | * Constructor for AvgValue. 47 | * 48 | * @param name 49 | */ 50 | public AvgValue(String name, String per, String x) { 51 | super(name, per, x); 52 | } 53 | 54 | /** 55 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 56 | */ 57 | @Override 58 | public void calculate(AbstractMetricSource source) { 59 | if (source.getSize() == 0) { 60 | source.setAverage(new Avg(getName(), per, 0, 0, 0)); 61 | } 62 | List metrics = source.getMetricsFromChildren(x); 63 | source.setAverage(Avg.createFromMetrics(name, per, metrics)); 64 | } 65 | 66 | /** 67 | * @see net.sourceforge.metrics.propagators.Propagator#createNextLevel() 68 | */ 69 | @Override 70 | public Propagator createNextLevel() { 71 | return new AvgAvg(name, per); 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "AvgValue(" + name + "," + per + ")"; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/MaxMax.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import java.util.List; 24 | 25 | import net.sourceforge.metrics.core.Max; 26 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 27 | 28 | /** 29 | * Propagate a maximum value 30 | * 31 | * @author Frank Sauer 32 | */ 33 | public class MaxMax extends Propagator { 34 | 35 | /** 36 | * Constructor for MaxMax. 37 | * 38 | * @param name 39 | */ 40 | public MaxMax(String name, String per) { 41 | super(name, per, name); 42 | } 43 | 44 | /** 45 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 46 | */ 47 | @Override 48 | public void calculate(AbstractMetricSource source) { 49 | List values = source.getMaximaFromChildren(name, per); 50 | Max max = Max.createFromMaxes(name, per, values); 51 | if (max != null) { 52 | source.setMaximum(max); 53 | } 54 | } 55 | 56 | /** 57 | * @see net.sourceforge.metrics.propagators.Propagator#createNextLevel() 58 | */ 59 | @Override 60 | public Propagator createNextLevel() { 61 | return this; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "MaxMax(" + name + "," + per + ")"; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/MaxValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.Max; 25 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 26 | 27 | /** 28 | * Calculate a maximum value 29 | * 30 | * @author Frank Sauer 31 | */ 32 | public class MaxValue extends Propagator implements Constants { 33 | 34 | /** 35 | * Constructor for MaxValue. 36 | * 37 | * @param name 38 | * name of the maximum 39 | * @param per 40 | * name of the scope 41 | * @param x 42 | * name of the metric to max 43 | */ 44 | public MaxValue(String name, String per, String x) { 45 | super(name, per, x); 46 | } 47 | 48 | /** 49 | * Constructor for MaxValue. 50 | * 51 | * @param name 52 | * name of the maximum as well as the metric to maximize 53 | * @param per 54 | * name of the scope 55 | */ 56 | public MaxValue(String name, String per) { 57 | super(name, per, name); 58 | } 59 | 60 | /** 61 | * @see net.sourceforge.metrics.calculators.Calculator#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 62 | */ 63 | @Override 64 | public void calculate(AbstractMetricSource source) { 65 | // List values = source.getMetricsFromChildren(x); 66 | Max m = Max.createFromChildMetrics(name, per, x, source); 67 | if (m != null) { 68 | source.setMaximum(m); 69 | } 70 | } 71 | 72 | /** 73 | * @see net.sourceforge.metrics.propagators.Propagator#createNextLevel() 74 | */ 75 | @Override 76 | public Propagator createNextLevel() { 77 | return new MaxMax(name, per); 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "MaxValue(" + name + "," + per + ")"; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/Propagator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import net.sourceforge.metrics.calculators.Calculator; 24 | 25 | /** 26 | * A Propagator propagates values up the source tree. Current implementations are Max, Avg and Sum. 27 | * 28 | * @author Frank Sauer 29 | */ 30 | public abstract class Propagator extends Calculator { 31 | 32 | protected String x = ""; 33 | protected String per = ""; 34 | 35 | /** 36 | * Constructor for Propagator. 37 | * 38 | * @param name 39 | */ 40 | public Propagator(String name, String per) { 41 | super(name); 42 | this.per = per; 43 | } 44 | 45 | /** 46 | * Constructor for Propagator. 47 | * 48 | * @param name 49 | * name of result 50 | * @param x 51 | * name of metric being propagated 52 | */ 53 | public Propagator(String name, String per, String x) { 54 | this(name, per); 55 | this.x = x; 56 | } 57 | 58 | /** 59 | * Returns the name of the metric being propagated. 60 | * 61 | * @return String 62 | */ 63 | public String getX() { 64 | return x; 65 | } 66 | 67 | /** 68 | * Sets the name of the metric being propagated. 69 | * 70 | * @param x 71 | * The x to set 72 | */ 73 | public void setX(String x) { 74 | this.x = x; 75 | } 76 | 77 | /** 78 | * Returns the scope of the value, e.g. per method or per class. 79 | * 80 | * @return String 81 | */ 82 | public String getPer() { 83 | return per; 84 | } 85 | 86 | /** 87 | * Sets the scope of the value, e.g. per method or per class. 88 | * 89 | * @param per 90 | * The per to set 91 | */ 92 | public void setPer(String per) { 93 | this.per = per; 94 | } 95 | 96 | public abstract Propagator createNextLevel(); 97 | } 98 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/Sum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.propagators; 22 | 23 | import net.sourceforge.metrics.core.Metric; 24 | import net.sourceforge.metrics.core.sources.AbstractMetricSource; 25 | 26 | /** 27 | * Calculates the sum of the metric with name x in the source's children. The name of the sum could be different 28 | * 29 | * @author Frank Sauer 30 | */ 31 | public class Sum extends Propagator { 32 | 33 | /** 34 | * Calculates the sum of the metric with name x in the source's children. The name of the sum could be different 35 | * 36 | * @param name 37 | * name of Sum 38 | * @param x 39 | * name of metric to be summed 40 | */ 41 | public Sum(String name, String x) { 42 | super(name, "", x); 43 | } 44 | 45 | /** 46 | * Calculates the sum of the metric with same name in the source's children. 47 | * 48 | * @param name 49 | * name of Sum and of metric to be summed 50 | */ 51 | public Sum(String name) { 52 | this(name, name); 53 | } 54 | 55 | /** 56 | * @see net.sourceforge.metrics.core.metrics.Metric#calculate(net.sourceforge.metrics.core.sources.AbstractMetricSource) 57 | */ 58 | @Override 59 | public void calculate(AbstractMetricSource source) { 60 | double sum = 0; 61 | for (Object element : source.getChildren()) { 62 | AbstractMetricSource next = (AbstractMetricSource) element; 63 | Metric partial = next.getValue(x); 64 | if (partial != null) { 65 | sum += partial.doubleValue(); 66 | } 67 | } 68 | source.setValue(new net.sourceforge.metrics.core.Sum(getName(), sum, isPropagator())); 69 | } 70 | 71 | private boolean isPropagator() { 72 | return getName().equals(x); 73 | } 74 | 75 | /** 76 | * @see net.sourceforge.metrics.propagators.Propagator#createNextLevel() 77 | */ 78 | @Override 79 | public Propagator createNextLevel() { 80 | return new Sum(name, name); 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "Sum(" + name + ")"; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/propagators/package.html: -------------------------------------------------------------------------------- 1 | 2 | These are "automatic" calculators. They propagate sums, averages and maxima 3 | up the containment hierarchy 4 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/OpenMetricsViewAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on Jul 6, 2003 3 | * 4 | * To change this generated comment go to 5 | * Window>Preferences>Java>Code Generation>Code Template 6 | */ 7 | package net.sourceforge.metrics.ui; 8 | 9 | import net.sourceforge.metrics.core.Log; 10 | 11 | import org.eclipse.jface.action.Action; 12 | import org.eclipse.ui.IWorkbenchPage; 13 | import org.eclipse.ui.IWorkbenchWindow; 14 | import org.eclipse.ui.PartInitException; 15 | import org.eclipse.ui.PlatformUI; 16 | 17 | /** 18 | * Used solely from within the welcome page 19 | * 20 | * @author Frank Sauer 21 | */ 22 | public class OpenMetricsViewAction extends Action { 23 | 24 | /** 25 | * 26 | */ 27 | public OpenMetricsViewAction() { 28 | super(); 29 | } 30 | 31 | /* 32 | * (non-Javadoc) 33 | * 34 | * @see org.eclipse.jface.action.IAction#run() 35 | */ 36 | @Override 37 | public void run() { 38 | IWorkbenchWindow dw = PlatformUI.getWorkbench().getWorkbenchWindows()[0]; 39 | IWorkbenchPage page = dw.getActivePage(); 40 | if (page != null) { 41 | MetricsView v = (MetricsView) page.findView("net.sourceforge.metrics.ui.MetricsView"); 42 | if (v == null) { 43 | try { 44 | page.showView("net.sourceforge.metrics.ui.MetricsView"); 45 | } catch (PartInitException e) { 46 | Log.logError("Could not create metrics view", e); 47 | } 48 | } 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/dependencies/PackageAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on May 12, 2003 3 | * 4 | * To change the template for this generated file go to 5 | * Window>Preferences>Java>Code Generation>Code and Comments 6 | */ 7 | package net.sourceforge.metrics.ui.dependencies; 8 | 9 | import org.eclipse.jdt.core.IJavaElement; 10 | import org.eclipse.jdt.core.JavaCore; 11 | 12 | import classycle.graph.Attributes; 13 | 14 | public class PackageAttributes implements Attributes { 15 | 16 | private String name = null; 17 | 18 | public PackageAttributes(String name) { 19 | this.name = name; 20 | } 21 | 22 | @Override 23 | public int hashCode() { 24 | return name.hashCode(); 25 | } 26 | 27 | @Override 28 | public boolean equals(Object o) { 29 | if (o == null) { 30 | return false; 31 | } 32 | if (o instanceof PackageAttributes) { 33 | return name.equals(((PackageAttributes) o).name); 34 | } 35 | if (o instanceof String) { 36 | return name.equals(o); 37 | } 38 | return false; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return name; 44 | } 45 | 46 | /** 47 | * @return 48 | */ 49 | public String getLabel() { 50 | if (name.startsWith("=")) { 51 | IJavaElement element = JavaCore.create(name); 52 | return element.getElementName(); 53 | } /* else { */ 54 | return name; 55 | /* } */ 56 | } 57 | 58 | public IJavaElement getJavaElement() { 59 | if (name.startsWith("=")) { 60 | return JavaCore.create(name); 61 | } /* else { */ 62 | return null; 63 | /* } */ 64 | } 65 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/layeredpackagegraph/LayeredPackageGraphView.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.ui.layeredpackagegraph; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Frame; 5 | import java.lang.reflect.Method; 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | import net.sourceforge.metrics.core.Log; 10 | 11 | import org.eclipse.swt.SWT; 12 | import org.eclipse.swt.events.ArmEvent; 13 | import org.eclipse.swt.events.ArmListener; 14 | import org.eclipse.swt.widgets.Composite; 15 | import org.eclipse.swt.widgets.Label; 16 | import org.eclipse.ui.part.ViewPart; 17 | 18 | import com.touchgraph.graphlayout.TGException; 19 | 20 | public class LayeredPackageGraphView extends ViewPart implements ArmListener { 21 | private static final String MESSAGE = "Please use the Layered Package Table View toolbar or menu to show a package graph."; 22 | private LayeredPackageGraphPanel glPanel; 23 | 24 | /** 25 | * 26 | */ 27 | public LayeredPackageGraphView() { 28 | super(); 29 | } 30 | 31 | /* 32 | * (non-Javadoc) 33 | * 34 | * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets .Composite) 35 | */ 36 | @Override 37 | public void createPartControl(Composite parent) { 38 | // Note: in 3.0M8 using SWT.EMBEDDED is critical. 39 | // without it the embedded component does not resize! 40 | Composite c = new Composite(parent, SWT.EMBEDDED); 41 | java.awt.Frame f = createAWTFrame(c); 42 | if (f != null) { // solution for bug #757046 ? 43 | glPanel = new LayeredPackageGraphPanel(); 44 | glPanel.setSize(800, 600); 45 | f.add("Center", glPanel); 46 | glPanel.showMessage(MESSAGE); 47 | LayeredPackageTableView.setArmListener(this); 48 | } else { 49 | Label l = new Label(c, SWT.NONE); 50 | l.setText(MESSAGE); 51 | l.setAlignment(SWT.CENTER); 52 | } 53 | } 54 | 55 | private java.awt.Frame createAWTFrame(Composite parent) { 56 | // try the final 3.0M7+ API 57 | try { 58 | Class clSWT_AWT = Class.forName("org.eclipse.swt.awt.SWT_AWT"); 59 | Method m = clSWT_AWT.getMethod("new_Frame", new Class[] { Composite.class }); 60 | java.awt.Frame f = (Frame) m.invoke(null, new Object[] { parent }); 61 | f.setLayout(new BorderLayout()); 62 | return f; 63 | } catch (Throwable e) { 64 | Log.logError("Could not embed awt panel using reflection", e); 65 | return null; 66 | } 67 | } 68 | 69 | public void setDependencies(final List> layers) { 70 | try { 71 | glPanel.createDependencies(layers); 72 | } catch (TGException e) { 73 | e.printStackTrace(); 74 | } 75 | } 76 | 77 | @Override 78 | public void setFocus() { 79 | } 80 | 81 | public void widgetArmed(ArmEvent e) { 82 | setDependencies(LayeredPackageTableView.getLayers()); 83 | } 84 | 85 | @Override 86 | public void dispose() { 87 | super.dispose(); 88 | if (glPanel != null) { 89 | glPanel.getTGPanel().clearAll(); 90 | glPanel = null; 91 | } 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/layeredpackagegraph/PackageStats.java: -------------------------------------------------------------------------------- 1 | package net.sourceforge.metrics.ui.layeredpackagegraph; 2 | 3 | /** 4 | * Holds layer statistics for a package 5 | */ 6 | public class PackageStats implements Comparable { 7 | private final String packageName; 8 | private int layer; 9 | private boolean tangle; 10 | 11 | public PackageStats(String packageName) { 12 | this.packageName = packageName; 13 | layer = 0; 14 | tangle = false; 15 | } 16 | 17 | public int getLayer() { 18 | return this.layer; 19 | } 20 | 21 | /** 22 | * Raises the layer of this object to the given level, if it is not already as high or higher. 23 | */ 24 | public void raiseTo(int level) { 25 | layer = Math.max(layer, level); 26 | } 27 | 28 | public void setTangle() { 29 | this.tangle = true; 30 | } 31 | 32 | public boolean isTangle() { 33 | return tangle; 34 | } 35 | 36 | public String getPackageName() { 37 | return packageName; 38 | } 39 | 40 | public int compareTo(PackageStats other) { 41 | int result = layer - other.layer; 42 | if (result != 0) { 43 | return result; 44 | } 45 | 46 | return packageName.compareTo(other.packageName); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/package.html: -------------------------------------------------------------------------------- 1 | 2 | These are the main metrics view ui classes 3 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/preferences/ColorPreferencePage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $Id: ColorPreferencePage.java,v 1.2 2004/05/01 19:23:18 sauerf Exp $ 20 | */ 21 | package net.sourceforge.metrics.ui.preferences; 22 | 23 | import net.sourceforge.metrics.core.Constants; 24 | import net.sourceforge.metrics.core.MetricsPlugin; 25 | 26 | import org.eclipse.jface.preference.ColorFieldEditor; 27 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 28 | import org.eclipse.ui.IWorkbench; 29 | import org.eclipse.ui.IWorkbenchPreferencePage; 30 | 31 | /** 32 | * Allow user to change color for inrange and out-of-range metrics 33 | * 34 | * @author Frank Sauer 35 | */ 36 | public class ColorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, Constants { 37 | 38 | /** 39 | * @param style 40 | */ 41 | public ColorPreferencePage() { 42 | super(GRID); 43 | setPreferenceStore(MetricsPlugin.getDefault().getPreferenceStore()); 44 | setDescription("Color preferences for metrics and dependency graph view"); 45 | } 46 | 47 | /* 48 | * (non-Javadoc) 49 | * 50 | * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors () 51 | */ 52 | @Override 53 | protected void createFieldEditors() { 54 | addField(new ColorFieldEditor("METRICS.defaultColor", "Default within range color", getFieldEditorParent())); 55 | addField(new ColorFieldEditor("METRICS.linkedColor", "Within range linked color", getFieldEditorParent())); 56 | addField(new ColorFieldEditor("METRICS.outOfRangeColor", "Out-of-range color", getFieldEditorParent())); 57 | addField(new ColorFieldEditor("METRICS.depGR_background", "Dependency Graph Background Color", getFieldEditorParent())); 58 | } 59 | 60 | /* 61 | * (non-Javadoc) 62 | * 63 | * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) 64 | */ 65 | public void init(IWorkbench workbench) { 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/preferences/LCOMPreferencePage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.ui.preferences; 22 | 23 | import net.sourceforge.metrics.core.MetricsPlugin; 24 | 25 | import org.eclipse.jface.preference.BooleanFieldEditor; 26 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 27 | import org.eclipse.ui.IWorkbench; 28 | import org.eclipse.ui.IWorkbenchPreferencePage; 29 | 30 | /** 31 | * Configure settings for LCOM*, E.g. the methods/attributes not to be considered. 32 | * 33 | * @see PreferencePage 34 | * @author Frank Sauer 35 | */ 36 | public class LCOMPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { 37 | 38 | /** 39 | * The constructor. 40 | */ 41 | public LCOMPreferencePage() { 42 | super(GRID); 43 | setPreferenceStore(MetricsPlugin.getDefault().getPreferenceStore()); 44 | setDescription("Settings for LCOM* (Lack of Cohesion of Methods)\nWARNING: changes invalidate cache and force recalculation!"); 45 | } 46 | 47 | public void init(IWorkbench workbench) { 48 | getPreferenceStore().setDefault("LCOM.StaticAttributes", false); 49 | getPreferenceStore().setDefault("LCOM.StaticMethods", false); 50 | } 51 | 52 | @Override 53 | public void createFieldEditors() { 54 | addField(new BooleanFieldEditor("LCOM.StaticAttributes", "Consider static fields in calculation", getFieldEditorParent())); 55 | addField(new BooleanFieldEditor("LCOM.StaticMethods", "Consider static methods in calculation", getFieldEditorParent())); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/preferences/XMLExportPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.ui.preferences; 22 | 23 | import net.sourceforge.metrics.core.ExportDescriptor; 24 | import net.sourceforge.metrics.core.MetricsPlugin; 25 | 26 | import org.eclipse.jface.preference.FieldEditorPreferencePage; 27 | import org.eclipse.jface.preference.RadioGroupFieldEditor; 28 | import org.eclipse.jface.util.PropertyChangeEvent; 29 | import org.eclipse.ui.IWorkbench; 30 | import org.eclipse.ui.IWorkbenchPreferencePage; 31 | 32 | /** 33 | * @author Frank Sauer 34 | */ 35 | public class XMLExportPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { 36 | 37 | private RadioGroupFieldEditor editor; 38 | 39 | public XMLExportPage() { 40 | super(GRID); 41 | setPreferenceStore(MetricsPlugin.getDefault().getPreferenceStore()); 42 | } 43 | 44 | @Override 45 | protected void createFieldEditors() { 46 | ExportDescriptor[] exporters = MetricsPlugin.getDefault().getExporters(); 47 | if (exporters.length > 0) { 48 | String[][] labels = new String[exporters.length][2]; 49 | for (int i = 0; i < exporters.length; i++) { 50 | ExportDescriptor next = exporters[i]; 51 | labels[i][0] = next.getName(); 52 | labels[i][1] = next.getClassName(); 53 | } 54 | editor = new RadioGroupFieldEditor("METRICS.xmlformat", "XML Export format", 1, labels, getFieldEditorParent(), true); 55 | addField(editor); 56 | } 57 | } 58 | 59 | /* 60 | * (non-Javadoc) 61 | * 62 | * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) 63 | */ 64 | public void init(IWorkbench workbench) { 65 | getPreferenceStore().setDefault("METRICS.xmlformat", "net.sourceforge.metrics.internal.xml.MetricsFirstExporter"); 66 | String current = getPreferenceStore().getString("METRICS.xmlformat"); 67 | ExportDescriptor xd = MetricsPlugin.getDefault().getExporter(current); 68 | if (xd != null) { 69 | setDescription(xd); 70 | } 71 | } 72 | 73 | /* 74 | * (non-Javadoc) 75 | * 76 | * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse .jface.util.PropertyChangeEvent) 77 | */ 78 | @Override 79 | public void propertyChange(PropertyChangeEvent event) { 80 | super.propertyChange(event); 81 | if (event.getSource() == editor) { 82 | String className = (String) event.getNewValue(); 83 | ExportDescriptor xd = MetricsPlugin.getDefault().getExporter(className); 84 | if (xd != null) { 85 | setDescription(xd); 86 | } 87 | } 88 | } 89 | 90 | /** 91 | * @param xd 92 | */ 93 | private void setDescription(ExportDescriptor xd) { 94 | setMessage(xd.getDescription()); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/src/net/sourceforge/metrics/ui/preferences/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains all classes related to the preference pages for the metrics plugin 3 | 4 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/test/net/sourceforge/metrics/internal/tests/AllTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.tests; 22 | 23 | import junit.framework.Test; 24 | import junit.framework.TestSuite; 25 | 26 | /** 27 | * @author Frank Sauer 28 | */ 29 | public class AllTests { 30 | 31 | public static Test suite() { 32 | TestSuite suite = new TestSuite("Test for net.sourceforge.metrics.tests"); 33 | // $JUnit-BEGIN$ 34 | suite.addTest(new TestSuite(AvgTests.class)); 35 | suite.addTest(new TestSuite(MaxTests.class)); 36 | // $JUnit-END$ 37 | return suite; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/test/net/sourceforge/metrics/internal/tests/AvgTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.tests; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | import junit.framework.TestCase; 27 | import net.sourceforge.metrics.core.Avg; 28 | import net.sourceforge.metrics.core.Metric; 29 | 30 | /** 31 | * @author Frank Sauer 32 | */ 33 | public class AvgTests extends TestCase { 34 | 35 | private static String name1 = "NAME1"; 36 | private List metrics1; 37 | private List metrics2; 38 | 39 | /** 40 | * Constructor for AvgTests. 41 | * 42 | * @param arg0 43 | */ 44 | public AvgTests(String arg0) { 45 | super(arg0); 46 | } 47 | 48 | public static void main(String[] args) { 49 | junit.textui.TestRunner.run(AvgTests.class); 50 | } 51 | 52 | /** 53 | * @see junit.framework.TestCase#setUp() 54 | */ 55 | @Override 56 | protected void setUp() throws Exception { 57 | super.setUp(); 58 | metrics1 = new ArrayList(); 59 | metrics2 = new ArrayList(); 60 | metrics1.add(new Metric(name1, 1)); 61 | metrics1.add(new Metric(name1, 3)); 62 | metrics1.add(new Metric(name1, 2)); 63 | metrics1.add(new Metric(name1, 6)); 64 | metrics2.add(new Metric(name1, 2)); 65 | metrics2.add(new Metric(name1, 4)); 66 | metrics2.add(new Metric(name1, 6)); 67 | metrics2.add(new Metric(name1, 4)); 68 | } 69 | 70 | public void testAvgFromMetrics() { 71 | Avg avg1 = Avg.createFromMetrics(name1, "per", metrics1); 72 | assertEquals("Wrong number of points", 4, avg1.getPoints()); 73 | assertEquals("Wrong average", 3, avg1.intValue()); 74 | assertEquals("Wrong variance", 3.5, avg1.getVariance(), 0); 75 | Avg avg2 = Avg.createFromMetrics(name1, "per", metrics2); 76 | assertEquals("Wrong number of points", 4, avg2.getPoints()); 77 | assertEquals("Wrong average", 4, avg2.intValue()); 78 | assertEquals("Wrong variance", 2.0, avg2.getVariance(), 0); 79 | } 80 | 81 | public void testAvgFromAverages() { 82 | Avg avg1 = Avg.createFromMetrics(name1, "per", metrics1); 83 | Avg avg2 = Avg.createFromMetrics(name1, "per", metrics2); 84 | List averages = new ArrayList(); 85 | averages.add(avg1); 86 | averages.add(avg2); 87 | Avg result = Avg.createFromAverages(name1, "per", averages); 88 | assertEquals("Wrong number of points", 8, result.getPoints()); 89 | assertEquals("Wrong average", 3.5, result.doubleValue(), 0); 90 | assertEquals("Wrong variance", 3.0, result.getVariance(), 0); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/test/net/sourceforge/metrics/internal/tests/MaxTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Frank Sauer. All rights reserved. 3 | * 4 | * Licenced under CPL 1.0 (Common Public License Version 1.0). 5 | * The licence is available at http://www.eclipse.org/legal/cpl-v10.html. 6 | * 7 | * 8 | * DISCLAIMER OF WARRANTIES AND LIABILITY: 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS". THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES, 11 | * EITHER EXPRESS OR IMPLIED. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL THE 12 | * AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS 13 | * OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, 14 | * HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO 15 | * ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE SOFTWARE, EVEN IF THE AUTHOR 16 | * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17 | * 18 | * 19 | * $id$ 20 | */ 21 | package net.sourceforge.metrics.internal.tests; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | import junit.framework.TestCase; 27 | import net.sourceforge.metrics.core.Max; 28 | import net.sourceforge.metrics.core.Metric; 29 | 30 | /** 31 | * @author Frank Sauer 32 | */ 33 | public class MaxTests extends TestCase { 34 | 35 | private static String name1 = "NAME1"; 36 | private List metrics; 37 | private List maxes; 38 | 39 | /** 40 | * Constructor for MaxTests. 41 | * 42 | * @param arg0 43 | */ 44 | public MaxTests(String arg0) { 45 | super(arg0); 46 | } 47 | 48 | public static void main(String[] args) { 49 | junit.textui.TestRunner.run(MaxTests.class); 50 | } 51 | 52 | /** 53 | * @see junit.framework.TestCase#setUp() 54 | */ 55 | @Override 56 | protected void setUp() throws Exception { 57 | super.setUp(); 58 | metrics = new ArrayList(); 59 | metrics.add(new Metric(name1, 1)); 60 | metrics.add(new Metric(name1, 3)); 61 | metrics.add(new Metric(name1, 2)); 62 | metrics.add(new Metric(name1, 5)); 63 | maxes = new ArrayList(); 64 | maxes.add(new Max(name1, "per", 1)); 65 | maxes.add(new Max(name1, "per", 4)); 66 | maxes.add(new Max(name1, "per", 10)); 67 | maxes.add(new Max(name1, "per", 6)); 68 | 69 | } 70 | 71 | public void testMaxFromMetrics() { 72 | Max max = Max.createFromMetrics(name1, "per", metrics); 73 | assertEquals("wrong expected max value", 5, max.intValue()); 74 | } 75 | 76 | public void testMaxFromMaxes() { 77 | Max max = Max.createFromMaxes(name1, "per", maxes); 78 | assertEquals("wrong expected max value", maxes.get(2), max); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/GraphListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout; 51 | 52 | import java.util.EventListener; 53 | 54 | /** 55 | * GraphListener. 56 | * 57 | * @author Alexander Shapiro 58 | * @version 1.22-jre1.1 $Id: GraphListener.java,v 1.1 2003/05/05 01:25:43 sauerf Exp $ 59 | */ 60 | public interface GraphListener extends EventListener { 61 | 62 | void graphMoved(); 63 | 64 | void graphReset(); 65 | 66 | } // end com.touchgraph.graphlayout.GraphListener 67 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/TGAbstractLens.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout; 51 | 52 | /** 53 | * TGAbstractLens. A lens warps 2D space. 54 | * 55 | * @author Alexander Shapiro 56 | * @version 1.22-jre1.1 $Id: TGAbstractLens.java,v 1.1 2003/05/05 01:25:43 sauerf Exp $ 57 | */ 58 | public abstract class TGAbstractLens { 59 | 60 | protected abstract void applyLens(TGPoint2D p); 61 | protected abstract void undoLens(TGPoint2D p); 62 | 63 | } // end com.touchgraph.graphlayout.TGAbstractLens 64 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/TGLayout.java: -------------------------------------------------------------------------------- 1 | package com.touchgraph.graphlayout; 2 | 3 | public interface TGLayout extends Runnable { 4 | public abstract void startDamper(); 5 | 6 | public abstract void stopDamper(); 7 | 8 | public abstract void resetDamper(); 9 | 10 | public abstract void stopMotion(); 11 | 12 | public abstract void damp(); 13 | 14 | public abstract void run(); 15 | 16 | public abstract void start(); 17 | 18 | public abstract void stop(); 19 | 20 | public abstract void setDragNode(Node node); 21 | } -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/TGPaintListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout; 51 | 52 | import java.awt.Graphics; 53 | import java.util.EventListener; 54 | 55 | /** 56 | * TGPaintListener. Implemented by any plugin that needs to do its own painting. 57 | * 58 | * @author Alexander Shapiro 59 | * @version 1.22-jre1.1 $Id: TGPaintListener.java,v 1.1 2003/05/05 01:25:43 sauerf Exp $ 60 | */ 61 | public interface TGPaintListener extends EventListener { 62 | 63 | void paintFirst(Graphics g); 64 | 65 | void paintAfterEdges(Graphics g); 66 | 67 | void paintLast(Graphics g); 68 | 69 | } // end com.touchgraph.graphlayout.TGPaintListener 70 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/graphelements/TGForEachEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout.graphelements; 51 | 52 | import com.touchgraph.graphlayout.Edge; 53 | 54 | /** 55 | * TGForEachEdge: A dummy object for iterating through edges 56 | * 57 | * @author Alexander Shapiro 58 | * @version 1.22-jre1.1 $Id: TGForEachEdge.java,v 1.1 2003/05/05 01:25:44 sauerf Exp $ 59 | */ 60 | public abstract class TGForEachEdge { 61 | 62 | public abstract void forEachEdge(Edge e); 63 | 64 | } // end com.touchgraph.graphlayout.graphelements.TGForEachEdge 65 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/graphelements/TGForEachNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout.graphelements; 51 | 52 | import com.touchgraph.graphlayout.Node; 53 | 54 | /** 55 | * TGForEachNode: A dummy object for iterating through nodes 56 | * 57 | * @author Alexander Shapiro 58 | * @version 1.22-jre1.1 $Id: TGForEachNode.java,v 1.1 2003/05/05 01:25:44 sauerf Exp $ 59 | */ 60 | public abstract class TGForEachNode { 61 | 62 | public abstract void forEachNode(Node n); 63 | 64 | } // end com.touchgraph.graphlayout.graphelements.TGForEachNode 65 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/graphelements/TGForEachNodePair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout.graphelements; 51 | 52 | import com.touchgraph.graphlayout.Node; 53 | 54 | /** 55 | * TGForEachNodePair: A dummy object for iterating through pairs of nodes 56 | * 57 | * @author Alexander Shapiro 58 | * @version 1.22-jre1.1 $Id: TGForEachNodePair.java,v 1.1 2003/05/05 01:25:44 sauerf Exp $ 59 | */ 60 | public abstract class TGForEachNodePair { 61 | 62 | public void beforeInnerLoop(Node n1) { 63 | }; 64 | 65 | public void afterInnerLoop(Node n1) { 66 | }; 67 | 68 | public abstract void forEachNodePair(Node n1, Node n2); 69 | 70 | } // end com.touchgraph.graphlayout.graphelements.TGForEachNodePair 71 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/graphelements/TGNodeQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout.graphelements; 51 | 52 | import java.util.Vector; 53 | 54 | import com.touchgraph.graphlayout.Node; 55 | 56 | /** 57 | * TGNodeQueue: a very simple queue implementation for doing a breadth first search. Should probably be implemented with linked lists. 58 | * 59 | * @author Alexander Shapiro 60 | * @version 1.22-jre1.1 $Id: TGNodeQueue.java,v 1.1 2003/05/05 01:25:44 sauerf Exp $ 61 | */ 62 | public class TGNodeQueue { 63 | 64 | Vector queue; 65 | 66 | public TGNodeQueue() { 67 | queue = new Vector(); 68 | } 69 | 70 | public void push(Node n) { 71 | queue.addElement(n); 72 | } 73 | 74 | public Node pop() { 75 | Node n = queue.elementAt(0); 76 | queue.removeElementAt(0); 77 | return n; 78 | } 79 | 80 | public boolean isEmpty() { 81 | return queue.size() == 0; 82 | } 83 | 84 | public boolean contains(Node n) { 85 | return queue.contains(n); 86 | } 87 | 88 | } // end com.touchgraph.graphlayout.graphelements.TGNodeQueue 89 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tgsrc/com/touchgraph/graphlayout/interaction/TGSelfDeactivatingUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchGraph LLC. Apache-Style Software License 3 | * 4 | * 5 | * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The end-user documentation included with the redistribution, 20 | * if any, must include the following acknowledgment: 21 | * "This product includes software developed by 22 | * TouchGraph LLC (http://www.touchgraph.com/)." 23 | * Alternately, this acknowledgment may appear in the software itself, 24 | * if and wherever such third-party acknowledgments normally appear. 25 | * 26 | * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 27 | * or promote products derived from this software without prior written 28 | * permission. For written permission, please contact 29 | * alex@touchgraph.com 30 | * 31 | * 5. Products derived from this software may not be called "TouchGraph", 32 | * nor may "TouchGraph" appear in their name, without prior written 33 | * permission of alex@touchgraph.com. 34 | * 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 38 | * DISCLAIMED. IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 39 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 42 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 43 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 44 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * ==================================================================== 47 | * 48 | */ 49 | 50 | package com.touchgraph.graphlayout.interaction; 51 | 52 | /** 53 | * TGSelfDeactivatingUI: A UI that can deactivate itself once its task is performed. For instance a dragUI can deactivate itself after the mouse is released. 54 | * 55 | * @author Alexander Shapiro 56 | * @version 1.22-jre1.1 $Id: TGSelfDeactivatingUI.java,v 1.1 2003/05/05 01:25:43 sauerf Exp $ 57 | */ 58 | public abstract class TGSelfDeactivatingUI extends TGUserInterface { 59 | 60 | boolean selfDeactivate; 61 | 62 | // ............ 63 | 64 | /** 65 | * Default constructor. 66 | */ 67 | public TGSelfDeactivatingUI() { 68 | selfDeactivate = true; 69 | } 70 | 71 | public void setSelfDeactivate(boolean sd) { 72 | selfDeactivate = sd; 73 | } 74 | 75 | } // end com.touchgraph.graphlayout.interaction.TGSelfDeactivatingUI 76 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/toc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tocapi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tocconcepts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/tocgettingstarted.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /net.sourceforge.metrics/welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

This page will help familiarize you with the Metrics plugin. To get started, read the sections below and click on the related links.

5 | 6 | Setting up a project for metrics calculation 7 | To configure a project for metrics calculation, open the Project properties and check the Enable Metrics checkbox. 8 | Now perform a full build to calculate the initial values for the metrics. 9 | 10 | Viewing the metrics 11 | Select Window->Show View->Other->Metrics->MetricsView 12 | 13 | Analyzing Dependencies 14 | When a project or root source folder is selected in the metrics view, select the icon that look like 15 | a square with four dots, or select Dependency Graph from the view menu. 16 | 17 | Learn More 18 | To learn more you can read the Metrics User Guide. 19 | 20 |
21 | -------------------------------------------------------------------------------- /updatesite/artifacts.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/artifacts.jar -------------------------------------------------------------------------------- /updatesite/content.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/content.jar -------------------------------------------------------------------------------- /updatesite/features/net.sourceforge.metrics_1.3.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/features/net.sourceforge.metrics_1.3.10.jar -------------------------------------------------------------------------------- /updatesite/features/net.sourceforge.metrics_1.3.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/features/net.sourceforge.metrics_1.3.9.jar -------------------------------------------------------------------------------- /updatesite/plugins/net.sourceforge.metrics_1.3.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/plugins/net.sourceforge.metrics_1.3.10.jar -------------------------------------------------------------------------------- /updatesite/plugins/net.sourceforge.metrics_1.3.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qxo/eclipse-metrics-plugin/08e51bd48725494aaa82023716ce659504948610/updatesite/plugins/net.sourceforge.metrics_1.3.9.jar --------------------------------------------------------------------------------