Package edu.pku.sei.metric.source

Examples of edu.pku.sei.metric.source.AbstractMetricElement


   * @return
   */
  public static AbstractMetricElement calculate(IJavaElement javaElement,
      IProgressMonitor monitor) {
    MetricElementBuilder builder = new MetricElementBuilder();
    AbstractMetricElement metricElement = builder.build(javaElement, analyzer, monitor);
    return metricElement;
  }
View Full Code Here


    MetricElementBuilder builder = new MetricElementBuilder();
    monitor.beginTask("calculate", elementList.size());
    for (Iterator<?> iter = elementList.iterator(); iter
        .hasNext();) {
      IJavaElement element = (IJavaElement) iter.next();
      AbstractMetricElement metricElement = builder.build(element, analyzer, monitor);
      parent.addChild(metricElement);
     
      monitor.worked(1);
    }   
    return parent;
View Full Code Here

   * @param javaElement
   * @return the AbstractMetricElement
   */
  public AbstractMetricElement build(IJavaElement javaElement,
      BundleAnalyzer analyzer, IProgressMonitor monitor) {
    AbstractMetricElement result = null;
    if (javaElement.getElementType() == IJavaElement.JAVA_PROJECT)
      result = new ProjectMetric(javaElement.getHandleIdentifier(),
          analyzer, monitor);
    else if (javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT)
      result = new PackageFragmentRootMetric(javaElement
View Full Code Here

    if (selections.size() == 1) {
      Job job = new Job("Calculating Metrics ..") {
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          IJavaElement javaElement = (IJavaElement) selections.get(0);
          AbstractMetricElement metricElement = FullMetricCaculator
              .calculate(javaElement, monitor);
          Activator.getDefault().getMetricsView().setSelection(
              metricElement);
          monitor.done();
          return Status.OK_STATUS;
        }
      };
      job.schedule();
    } else {
      Job job = new Job("Calculating Metrics ...") {
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          AbstractMetricElement parent = new FakeMetric();
          parent = FullMetricCaculator.calculate(selections, parent,
              monitor);
          Activator.getDefault().getMetricsView()
              .setSelection(parent);
          monitor.done();
View Full Code Here

    if (metricElement.getLevel() > level) {
      List<AbstractMetricElement> children = metricElement.getChildren();
      double max = 0;
      String handle = null;
      for (int i = 0; i < children.size(); i++) {
        AbstractMetricElement child = children.get(i);
        if (null != child.getMaxValue(metricName)
            && child.getMaxValue(metricName).getValue() > max) {
          max = child.getMaxValue(metricName).getValue();
          handle = child.getMaxValue(metricName).getHandle();
        }
      }
      if (null != handle)
        metricElement
            .setMaxValue(new MaxValue(metricName, max, handle));
View Full Code Here

      double sum = 0;
      double num = 0;
      double mean = 0;

      for (int i = 0; i < children.size(); i++) {
        AbstractMetricElement child = children.get(i);
        if (null != child.getAverageValue(metricName)) {
          sum += child.getAverageValue(metricName).getValue()
              * child.getAverageValue(metricName).getNum();
          num += child.getAverageValue(metricName).getNum();
        }
      }
      if (num != 0)
        mean = sum / num;
      metricElement.setAverageValue(new AvgValue(metricName, mean, num));
View Full Code Here

    if (metricElement.getLevel() > level) {
      List<AbstractMetricElement> children = metricElement.getChildren();
      double min = 10000;
      String handle = null;
      for (int i = 0; i < children.size(); i++) {
        AbstractMetricElement child = children.get(i);
        if (null != child.getMinValue(metricName)
            && child.getMinValue(metricName).getValue() < min) {
          min = child.getMinValue(metricName).getValue();
          handle = child.getMinValue(metricName).getHandle();
        }
      }
      if (null != handle)
        metricElement
            .setMinValue(new MinValue(metricName, min, handle));
View Full Code Here

TOP

Related Classes of edu.pku.sei.metric.source.AbstractMetricElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.