CPD Results

The following document contains the results of PMD's CPD 3.9.

Duplications

FileLine
net\sf\statcvs\output\CvswebIntegration.java74
net\sf\statcvs\output\ViewCvsIntegration.java74
    protected String getFileUrl(final VersionedFile file, final String parameter) {
        String filename;
        if (isInAttic(file)) {
            final String path = file.getDirectory().getPath();
            filename = "/" + path + "Attic/" + file.getFilename();

        } else {
            filename = "/" + file.getFilenameWithPath();
        }

        String append = parameter;
        if (this.postfix != null) {
            append += (append.length() > 0) ? "&" + this.postfix : "?" + this.postfix;
        }
        return this.baseURL + filename + append;
    }

    /**
     * @see net.sf.statcvs.output.WebRepositoryIntegration#getFileHistoryUrl
     */
    public String getFileHistoryUrl(final VersionedFile file) {
        return getFileUrl(file, "");
    }

    /**
     * @see net.sf.statcvs.output.WebRepositoryIntegration#getFileViewUrl(VersionedFile)
     */
    public String getFileViewUrl(final VersionedFile file) {
        return getFileUrl(file, "?rev=HEAD&content-type=text/vnd.viewcvs-markup");
    }

    /**
     * @see net.sf.statcvs.output.WebRepositoryIntegration#getFileViewUrl(VersionedFile)
     */
    public String getFileViewUrl(final Revision revision) {
        return getFileUrl(revision.getFile(), "?rev=" + revision.getRevisionNumber() + "&content-type=text/vnd.viewcvs-markup");
    }

    /**
     * @see net.sf.statcvs.output.WebRepositoryIntegration#getDiffUrl
     */
    public String getDiffUrl(final Revision oldRevision, final Revision newRevision) {
        if (!oldRevision.getFile().equals(newRevision.getFile())) {
            throw new IllegalArgumentException("revisions must be of the same file");
        }
        return getFileUrl(oldRevision.getFile(), ".diff?r1=" + oldRevision.getRevisionNumber() + "&r2=" + newRevision.getRevisionNumber());

FileLine
net\sf\statcvs\pages\xml\AllDevelopersXml.java49
net\sf\statcvs\pages\xml\FilesXml.java74
        final String[] str = new String[NO_OF_COLS_IN_EXT_TABLE];
        for (int j = 0; j < table.getRowCount(); j++) {
            Element col = null;
            int i = 0;
            final Iterator it = table.getColumnIterator();
            final Iterator itr = table.getColumnIterator();
            while (it.hasNext()) {
                final Column column = (Column) it.next();
                column.renderHead(renderer);
                str[i] = renderer.getColumnHead();
                if (i == 0) {
                    col = new Element(str[i]);
                } else {
                    col.addContent(new Element(str[i]));
                }
                i++;
            }
            boolean isFirstColumn = true;
            int k = 0;
            while (itr.hasNext()) {
                final Column column = (Column) itr.next();
                column.renderCell(j, renderer);
                if (isFirstColumn && table.hasKeysInFirstColumn()) {
                    col.setAttribute("ext", renderer.getRowHead().toLowerCase());

FileLine
net\sf\statcvs\pages\FileSizesPageMaker.java55
net\sf\statcvs\pages\xml\FilesXml.java201
    }

    /**
     * returns Integer of the number of files
     *
     * @returns int
     */
    private int getCurrentFileCount() {
        int result = 0;
        final Iterator it = this.repository.getFiles().iterator();
        while (it.hasNext()) {
            final VersionedFile file = (VersionedFile) it.next();
            if (!file.isDead()) {
                result++;
            }
        }
        return result;
    }

    /**
     * returns the average size of a file in terms of LOC
     *
     * @returns double
     */
    private double getCurrentAverageFileSize() {
        return ((double) this.repository.getCurrentLOC()) / getCurrentFileCount();
    }

    /**
     * returns number of revisions done on average
     *
     * @returns double
     */
    private double getCurrentAverageRevisionCount() {
        int revisions = 0;
        final Iterator it = this.repository.getFiles().iterator();
        while (it.hasNext()) {
            final VersionedFile file = (VersionedFile) it.next();
            if (!file.isDead()) {
                revisions += file.getRevisions().size();
            }
        }
        return ((double) revisions) / getCurrentFileCount();
    }
}

FileLine
net\sf\statcvs\pages\xml\LogXmlMaker.java21
net\sf\statcvs\pages\xml\RevisedFilesXml.java28
public class RevisedFilesXml {
    private final static String[] MONTH_TWO_CHARACTERS = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };

    public static String getAnchor(final SymbolicName tag) {
        return "tag-" + tag.getName();
    }

    public static String getURL(final Date date) {
        final Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        return getFileName(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)) + ".html";
    }

    private static String getFileName(final int year, final int month) {
        return year + "-" + MONTH_TWO_CHARACTERS[month];
    }

    private final Repository repo;

FileLine
net\sf\statcvs\pages\xml\FilesXml.java130
net\sf\statcvs\pages\xml\FilesXml.java177
                    col = new Element(str[i]);
                } else {
                    str[i] = renderer.getColumnHead().replaceAll(" ", "_");
                    //col.addContent(new Element (str[i]));
                }
                i++;
            }

            boolean isFirstColumn = true;
            int k = 0;
            while (itr.hasNext()) {
                final Column column = (Column) itr.next();
                column.renderCell(j, renderer);
                if (isFirstColumn && table.hasKeysInFirstColumn()) {
                    col.setText(/*removeHTML(*/renderer.getRowHead());
                    isFirstColumn = false;
                } else {
                    col.setAttribute(str[k].toLowerCase(), renderer.getTableCell());
                }
                k++;
            }

FileLine
net\sf\statcvs\pages\xml\AllDevelopersXml.java49
net\sf\statcvs\pages\xml\FilesXml.java119
        final String[] str = new String[NO_OF_COLS_IN_LARG_TABLE];
        for (int j = 0; j < table.getRowCount(); j++) {
            Element col = null;
            int i = 0;
            final Iterator it = table.getColumnIterator();
            final Iterator itr = table.getColumnIterator();
            while (it.hasNext()) {
                final Column column = (Column) it.next();
                column.renderHead(renderer);
                str[i] = renderer.getColumnHead();
                if (i == 0) {
                    col = new Element(str[i]);
                } else {