CPD Results

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

Duplications

FileLine
org/treetank/revisioning/Incremental.java18
org/treetank/revisioning/SlidingSnapshot.java18
public class Incremental implements IRevisioning {

    /**
     * {@inheritDoc}
     */
    @Override
    public DataBucket combineBuckets(final DataBucket[] pBuckets) {
        checkArgument(pBuckets.length > 0, "At least one DataBucket must be provided");
        // create entire bucket..
        final DataBucket returnVal = new DataBucket(pBuckets[0].getBucketKey(), pBuckets[0].getLastBucketPointer());
        // ...iterate through the datas and check if it is stored..
        for (int i = 0; i < pBuckets[0].getDatas().length; i++) {
            boolean bucketSkip = false;
            // ... form the newest version to the oldest one..
            for (int j = 0; !bucketSkip && j < pBuckets.length; j++) {
                // if the data is not set yet but existing in the current version..
                if (pBuckets[j].getData(i) != null) {
                    // ...break out the loop the next time and..
                    bucketSkip = true;
                    // ...set it
                    returnVal.setData(i, pBuckets[j].getData(i));
                }

            }
        }
        return returnVal;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public LogValue combineBucketsForModification(int pRevisionsToRestore, long pNewBucketKey, DataBucket[] pBuckets,
        boolean pFullDump) {
        checkArgument(pBuckets.length > 0, "At least one DataBucket must be provided");
        // create buckets for container..
        final DataBucket[] returnVal =
            {
                new DataBucket(pBuckets[0].getBucketKey(), pBuckets[0].getLastBucketPointer()),
                new DataBucket(pNewBucketKey, pBuckets[0].getBucketKey())
            };
        // ...iterate through the datas and check if it is stored..
        for (int i = 0; i < pBuckets[0].getDatas().length; i++) {
            boolean bucketSkip = false;
FileLine
org/treetank/bucket/IndirectBucket.java83
org/treetank/bucket/RevisionRootBucket.java126
            pOutput.writeLong(mBucketKey);
            for (long key : mReferenceKeys) {
                pOutput.writeLong(key);
            }
            for (byte[] hash : mReferenceHashs) {
                pOutput.writeInt(hash.length);
                pOutput.write(hash);
            }
        } catch (final IOException exc) {
            throw new TTIOException(exc);
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public long getBucketKey() {
        return mBucketKey;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public long[] getReferenceKeys() {
        return mReferenceKeys;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setReferenceKey(int pIndex, long pKey) {
        mReferenceKeys[pIndex] = pKey;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return toStringHelper(this).add("mBucketKey", mBucketKey).add("mReferenceKeys",
FileLine
org/treetank/bucket/DumbMetaEntryFactory.java92
org/treetank/bucket/DumbMetaEntryFactory.java173
                pOutput.writeInt(KEY);
                pOutput.writeLong(mData);
            } catch (final IOException exc) {
                throw new TTIOException(exc);
            }
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public int hashCode() {
            return Objects.hash(mData);
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public final boolean equals(final Object pObj) {
            return this.hashCode() == pObj.hashCode();
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public String toString() {
            return toStringHelper(this).add("mData", mData).toString();
        }
        
        /**
         * {@inheritDoc}
         */
        @Override
        public Funnel<IMetaEntry> getFunnel() {
            return DumbKeyFunnel.INSTANCE;