Package com.ubx1.pdpscanner.shared

Examples of com.ubx1.pdpscanner.shared.Project


   * @return the value for the chart which corresponds to the given stat kind
   *         and version
   */
  private int getChartValue(GeneralStat s, int version) {

    Project p = this.project;

    int value = -1;

    switch (s) {
    case LOC:
      value = p.getNloc(version);
      break;
    case FUNC:
      value = p.getNfunc(version);
      break;
    case CL:
      value = p.getNcl(version);
      break;
    case PKG:
      value = p.getNpkg(version);
      break;
    case FILE:
      value = p.getNfile(version);
      break;
    case COM:
      int ncom = p.getNcom(version);
      int nloc = p.getNloc(version);

      if (ncom != -1 && nloc != -1) {
        Double pcom = (new Double(ncom) / new Double(nloc)) * 100.;
        value = (int) Math.round(pcom);
      }
      break;
    case DUPL:
      int ndupl = p.getNdupl(version);
      int nloc1 = p.getNloc(version);

      if (ndupl != -1 && nloc1 != -1) {
        Double pdupl = (new Double(ndupl) / new Double(nloc1)) * 100.;
        value = (int) Math.round(pdupl);
      }
View Full Code Here


   *
   * @return the data table for the chart
   */
  private AbstractDataTable createTestChartDataTable() {

    Project p = this.project;
    int v = this.version;

    DataTable data = DataTable.create();
    data.addColumn(ColumnType.STRING, "Commentaires");
    data.addColumn(ColumnType.NUMBER,
        "Pourcentage de code qui correspond à des commentaires");
    data.addRows(2);

    int comValue = p.getNcom(v);
    int locValue = p.getNloc(v)+p.getNcom(v);

    data.setValue(0, 0, "Lignes de code qui sont des commentaires");
    data.setValue(0, 1, comValue);
    data.setValue(1, 0, "Lignes de code qui ne sont pas des commentaires");
    data.setValue(1, 1, locValue - comValue);
View Full Code Here

   *
   * @return the data table for the chart
   */
  private AbstractDataTable createTestChartDataTable() {

    Project p = this.project;
    int v = this.version;

    DataTable data = DataTable.create();
    data.addColumn(ColumnType.STRING, "Duplication de code");
    data.addColumn(ColumnType.NUMBER, "Pourcentage de duplication de code");
    data.addRows(2);

    int duplValue = p.getNdupl(v);
    int locValue = p.getNloc(v);

    data.setValue(0, 0, "Lignes de code dupliquées");
    data.setValue(0, 1, duplValue);
    data.setValue(1, 0, "Lignes de code non dupliquées");
    data.setValue(1, 1, locValue - duplValue);
View Full Code Here

  /**
   * Create the version list
   */
  private void buildVersionList() {

    Project p = this.project;

    // Clear the version list
    this.versionList.clear();

    // The project must have at least one version for the version list to
    // have purpose
    if (p.getVersionCount() > 0) {

      this.versionList.setEnabled(true);

      this.versionList.addItem("Dernière version (" + p.getVersionCount()
          + ")", String.valueOf(p.getVersionCount()));
      for (int i = p.getVersionCount() - 1; i > 0; i--) {
        this.versionList.addItem("Version " + i, String.valueOf(i));
      }

      // If there are more than a single version, the user can use a chart
      if (p.getVersionCount() > 1) {

        this.versionList.addItem("Toutes les versions",
            String.valueOf(-1));
      }

View Full Code Here

  /**
   * Fill the value label
   */
  private void fillValueLabel() {

    Project p = this.project;
    int v = this.version;

    int ndupl = p.getNdupl(v);
    int nloc = p.getNloc(v);

    if (ndupl == -1 || nloc == -1) {
      duplValueLabel.setText("--");
    } else {

View Full Code Here

    Iterator<Entry<String, Project>> it = PdpScanner.projects.entrySet()
        .iterator();

    while (it.hasNext()) {

      final Project p = it.next().getValue();

      // Add project to projects table
      Hyperlink projectLink = new Hyperlink(p.getName() + " ("
          + p.getOwner() + ")", "Project~" + p.getName());
      projectTable.setWidget(row, 0, projectLink);
      // Compute the number of days elapsed between the project
      // creation date and now
      DateTimeFormat dateFormatter = new DateTimeFormat(
          "yyyy-MM-dd HH:mm:ss") {
      };

      Date d1 = dateFormatter.parse(p.getCreationDate());

      Date d2 = new Date();

      String days = String.valueOf((d2.getTime() - d1.getTime())
          / MILLIS_PER_DAY);

      projectTable.setText(row, 1, days);

      if (p.getNloc(p.getVersionCount()) == -1)
        projectTable.setText(row, 2, "--");
      else
        projectTable.setText(row, 2,
            String.valueOf(p.getNloc(p.getVersionCount())));

      dateFormatter = new DateTimeFormat("dd/MM/yyyy, à HH:mm") {
      };
      projectTable.setText(row, 3, dateFormatter.format(d1));
View Full Code Here

        PdpScanner.projects.clear();

        // Add projects to hashmap
        for (int i = 0; i < result.length; i++) {

          Project p = result[i];
          PdpScanner.projects.put(p.getName(), p);
        }

        HomeView.this.fillProjectTable();
      }
    };
View Full Code Here

  /**
   * Fill the label for showing the differential with the previous version
   */
  private void fillDiffLabel() {

    Project p = this.project;
    int v = this.version;

    // If there is an anterior version
    if (v > 1) {

      if (p.getNdupl(v) != -1 && p.getNdupl(v - 1) != -1) {

        if (p.getNdupl(v) > p.getNdupl(v - 1)) {
          diffDuplLabel.setText("(+)");
          diffDuplLabel.setStyleDependentName("green", false);
          diffDuplLabel.setStyleDependentName("red", true);
        } else if (p.getNdupl(v) < p.getNdupl(v - 1)) {
          diffDuplLabel.setText("(-)");
          diffDuplLabel.setStyleDependentName("red", false);
          diffDuplLabel.setStyleDependentName("green", true);
        }
      }
View Full Code Here

   *
   * @return the data table for the chart
   */
  private AbstractDataTable createTestChartDataTable() {

    Project p = this.project;

    DataTable data = DataTable.create();
    data.addColumn(ColumnType.STRING, "Version");
    data.addColumn(ColumnType.NUMBER, "Lignes de code à tester");
    data.addColumn(ColumnType.NUMBER, "Lignes de code testées");
    data.addRows(p.getVersionCount());

    // Unavailable stats counter
    int z = 0;

    for (int i = 0; i < p.getVersionCount(); i++) {

      int locValue = p.getNloc(i + 1);
      int covValue = p.getNcovl(i + 1);

      // If no value is available for this version, don't represent it on
      // the chart
      if (locValue == -1 || covValue == -1) {
        z++;
View Full Code Here

  /**
   * Fill the value label
   */
  private void fillValueLabel() {

    Project p = this.project;
    int v = this.version;

    int ncom = p.getNcom(v);
    int nloc = p.getNloc(v);

    if (ncom == -1 || nloc == -1) {
      comValueLabel.setText("--");
    } else {

View Full Code Here

TOP

Related Classes of com.ubx1.pdpscanner.shared.Project

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.