CPD Results

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

Duplications

FileLine
org/millscript/office/spreadsheet/worksheets/WorksheetImpl.java72
org/millscript/office/spreadsheet/rows/IRowList.java60
    public IRowList( final Cell[][] rows, final int start, final int end ) {
        if ( start > end ) {
            this.rowData = null;
        } else if ( start < 1 || start > rows.length ) {
            throw new ListIndexOutOfBoundsAlert(
                "First index in slice must be between 1 and the number of rows"
            ).culprit(
                "index",
                start
            ).decorate( rows ).mishap();
        } else if ( end > rows.length ) {
            throw new ListIndexOutOfBoundsAlert(
                "Last index in slice must not be greater than the number of rows"
            ).culprit(
                "index",
                end
            ).decorate( rows ).mishap();
        } else {
            this.rowData = new Cell[ end - start + 1 ][];
            try {
                System.arraycopy( rows, start - 1, this.rowData, 0, this.rowData.length );
            } catch ( Exception ex ) {
                throw new Fault(
                    "Failed to take a copy of the specified array slice"
                ).setParentThrowable( ex ).mishap();
            } 
        }
    }

    /**
     * @see org.millscript.commons.util.list.AbstractIList#doGet(int)
     */
    @Override
    protected Row doGet( final int pos ) {
        final Cell[] row = this.rowData[ pos - 1 ];
        if ( row == null ) {
            return new RowImpl();
        } else {
            return new RowImpl( row, true );
        }
    }

    /**
     * @see org.millscript.commons.util.list.AbstractIList#doSlice(int, int, boolean)
     */
    @Override
    protected IList< Row > doSlice( int first, int last, boolean share ) {

FileLine
org/millscript/office/excel/records/syntax/NameRecordSyntax.java95
org/millscript/office/excel/records/syntax/NameRecordSyntax.java132
    public void handleBIFF8( final RecordTokenizer tokenizer, final Name name ) {
        // Set the name options
        name.setOptions( tokenizer.read2ByteInt() );
        // Set the keyboard shortcut
        name.setKeyboardShortcut( tokenizer.readByte() );
        // Read the length of the name
        final int nameLength = tokenizer.readUnsignedByte();
        // Read the formula size
        final int formulaSize = tokenizer.readUnsigned2Byte();
        // Set the index to the EXTERNSHEET record
        name.setIndexToExternSheetRecord( tokenizer.readUnsigned2Byte() );
        // Set the index to the sheet
        name.setIndexToSheet( tokenizer.readUnsigned2Byte() );
        // Read the length of the menu text
        final int menuTextLength = tokenizer.readUnsignedByte();
        // Read the length of the description text
        final int descriptionTextLength = tokenizer.readUnsignedByte();
        // Read the length of the help topic text
        final int helpTopicTextLength = tokenizer.readUnsignedByte();
        // Read the length of the status bar text
        final int statusBarTextLength = tokenizer.readUnsignedByte();
        // Set the name
        name.setName( tokenizer.readString( nameLength ) );
        // Set the formula
        name.setFormulaExpr( tokenizer.readFormula( formulaSize, 0 ) );

FileLine
org/millscript/office/spreadsheet/worksheets/WorksheetImpl.java72
org/millscript/office/spreadsheet/rows/ISharedRowList.java63
    public ISharedRowList( final Cell[][] rows, final int start, final int end ) {
        if ( start > end ) {
            this.rowData = null;
        } else if ( start < 1 || start > rows.length ) {
            throw new ListIndexOutOfBoundsAlert(
                "First index in slice must be between 1 and the number of rows"
            ).culprit(
                "index",
                start
            ).decorate( rows ).mishap();
        } else if ( end > rows.length ) {
            throw new ListIndexOutOfBoundsAlert(
                "Last index in slice must not be greater than the number of rows"
            ).culprit(
                "index",
                end
            ).decorate( rows ).mishap();
        } else {
            this.rowData = rows;