Fork me on GitHub

CPD Results

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

Duplications

File Line
app/keve/ktlsh/impl/TLSHDigest7.java 54
app/keve/ktlsh/impl/TLSHDigest8.java 54
        int l6 = (int) (lag >>> 40 & 0xFF);
        while (buf.hasRemaining()) {
            final int l0 = buf.get() & 0xFF;
            count++;
            if (count >= windowLength) {
                switch (checkSumLength) {
                case 1:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    break;
                case 3:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    checksum[1] = bMapping(checksum[0], l0, l1, checksum[1]);
                    checksum[2] = bMapping(checksum[1], l0, l1, checksum[2]);
                    break;
                default:
//                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
//                    for (int k = 1; k < checksum.length; k++) {
//                        checksum[k] = bMapping(checksum[k - 1], l0, l1, checksum[k]);
//                    }
//                    break;
                    throw new IllegalArgumentException("impossible");
                }

                aBucket[sMapping(T2, l0, l1, l2)]++;
                aBucket[sMapping(T3, l0, l1, l3)]++;
                aBucket[sMapping(T5, l0, l2, l3)]++;

                aBucket[sMapping(T7, l0, l2, l4)]++;
                aBucket[sMapping(T11, l0, l1, l4)]++;
                aBucket[sMapping(T13, l0, l3, l4)]++;

                aBucket[sMapping(T17, l0, l1, l5)]++;
                aBucket[sMapping(T19, l0, l2, l5)]++;
                aBucket[sMapping(T23, l0, l3, l5)]++;
                aBucket[sMapping(T29, l0, l4, l5)]++;

                aBucket[sMapping(T31, l0, l1, l6)]++;
                aBucket[sMapping(T37, l0, l2, l6)]++;
                aBucket[sMapping(T41, l0, l3, l6)]++;
                aBucket[sMapping(T43, l0, l4, l6)]++;
                aBucket[sMapping(T47, l0, l5, l6)]++;
File Line
app/keve/ktlsh/impl/TLSHDigest6.java 53
app/keve/ktlsh/impl/TLSHDigest7.java 54
app/keve/ktlsh/impl/TLSHDigest8.java 54
        int l5 = (int) (lag >>> 32 & 0xFF);
        while (buf.hasRemaining()) {
            final int l0 = buf.get() & 0xFF;
            count++;
            if (count >= windowLength) {
                switch (checkSumLength) {
                case 1:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    break;
                case 3:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    checksum[1] = bMapping(checksum[0], l0, l1, checksum[1]);
                    checksum[2] = bMapping(checksum[1], l0, l1, checksum[2]);
                    break;
                default:
//                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
//                    for (int k = 1; k < checksum.length; k++) {
//                        checksum[k] = bMapping(checksum[k - 1], l0, l1, checksum[k]);
//                    }
//                    break;
                    throw new IllegalArgumentException("impossible");
                }

                aBucket[sMapping(T2, l0, l1, l2)]++;
                aBucket[sMapping(T3, l0, l1, l3)]++;
                aBucket[sMapping(T5, l0, l2, l3)]++;

                aBucket[sMapping(T7, l0, l2, l4)]++;
                aBucket[sMapping(T11, l0, l1, l4)]++;
                aBucket[sMapping(T13, l0, l3, l4)]++;

                aBucket[sMapping(T17, l0, l1, l5)]++;
                aBucket[sMapping(T19, l0, l2, l5)]++;
                aBucket[sMapping(T23, l0, l3, l5)]++;
                aBucket[sMapping(T29, l0, l4, l5)]++;
File Line
app/keve/ktlsh/impl/TLSHDigest4.java 52
app/keve/ktlsh/impl/TLSHDigest6.java 54
app/keve/ktlsh/impl/TLSHDigest7.java 55
app/keve/ktlsh/impl/TLSHDigest8.java 55
        while (buf.hasRemaining()) {
            final int l0 = buf.get() & 0xFF;
            count++;
            if (count >= windowLength) {
                switch (checkSumLength) {
                case 1:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    break;
                case 3:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    checksum[1] = bMapping(checksum[0], l0, l1, checksum[1]);
                    checksum[2] = bMapping(checksum[1], l0, l1, checksum[2]);
                    break;
                default:
//                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
//                    for (int k = 1; k < checksum.length; k++) {
//                        checksum[k] = bMapping(checksum[k - 1], l0, l1, checksum[k]);
//                    }
//                    break;
                    throw new IllegalArgumentException("impossible");
                }

                aBucket[sMapping(T2, l0, l1, l2)]++;
                aBucket[sMapping(T3, l0, l1, l3)]++;
                aBucket[sMapping(T5, l0, l2, l3)]++;
File Line
app/keve/ktlsh/impl/TLSHDigest5.java 82
app/keve/ktlsh/impl/TLSHDigest5c1.java 68
            aBucket[sMapping(T2, l0, l1, l2)]++;
            aBucket[sMapping(T3, l0, l1, l3)]++;
            aBucket[sMapping(T5, l0, l2, l3)]++;

            aBucket[sMapping(T7, l0, l2, l4)]++;
            aBucket[sMapping(T11, l0, l1, l4)]++;
            aBucket[sMapping(T13, l0, l3, l4)]++;

            l4 = l3;
            l3 = l2;
            l2 = l1;
            l1 = l0;
        }
        lag = l4 << 24 | l3 << 16 | l2 << 8 | l1;
    }

    @Override
    protected int[] getLag() {
        return new int[] {lag & 0xFF, lag >>> 8 & 0xFF, lag >>> 16 & 0xFF, lag >>> 24 & 0xFF};
    }
}
File Line
app/keve/ktlsh/impl/TLSHDigest5.java 69
app/keve/ktlsh/impl/TLSHDigest6.java 62
app/keve/ktlsh/impl/TLSHDigest7.java 63
app/keve/ktlsh/impl/TLSHDigest8.java 63
            case 3:
                checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                checksum[1] = bMapping(checksum[0], l0, l1, checksum[1]);
                checksum[2] = bMapping(checksum[1], l0, l1, checksum[2]);
                break;
            default:
//                checksum[0] = sMapping(T0, l0, l1, checksum[0]);
//                for (int k = 1; k < checksum.length; k++) {
//                    checksum[k] = bMapping(checksum[k - 1], l0, l1, checksum[k]);
//                }
//                break;
                throw new IllegalArgumentException("impossible");
            }
            aBucket[sMapping(T2, l0, l1, l2)]++;
            aBucket[sMapping(T3, l0, l1, l3)]++;
            aBucket[sMapping(T5, l0, l2, l3)]++;

            aBucket[sMapping(T7, l0, l2, l4)]++;
            aBucket[sMapping(T11, l0, l1, l4)]++;
            aBucket[sMapping(T13, l0, l3, l4)]++;
File Line
app/keve/ktlsh/TestExampleData.java 153
app/keve/ktlsh/TestExampleData.java 210
        expLenXrefScore().parallel().forEach(a -> {
            final Object[] arguments = a.get();
//            final String resourceGroup = (String) arguments[0];
            final String bits = (String) arguments[1];
            final String check = (String) arguments[2];
            final String resource1Name = (String) arguments[3];
            final String resource2Name = (String) arguments[4];
            final int expectedScore = (int) arguments[4 + 1];

            try {
                final MessageDigest mdx = MessageDigest.getInstance(formatAlg(bits, check), provider);
                try (InputStream resource1 = resourceStream(resource1Name);
                        InputStream resource2 = resourceStream(resource2Name)) {
                    final int score = getScore(mdx, resource1, resource2, true);
File Line
app/keve/ktlsh/impl/TestDigest.java 177
app/keve/ktlsh/impl/TestDigest.java 216
    public void testDigestSmall(final int buckets, final int checksum) {
        final TLSHDigest kd = TLSHDigest.of(5, buckets, checksum);
        final TlshCreator td = new TlshCreator(128 == buckets ? BucketOption.BUCKETS_128 : BucketOption.BUCKETS_256,
                1 == checksum ? ChecksumOption.CHECKSUM_1B : ChecksumOption.CHECKSUM_3B);

        final byte[] buf = new byte[MEDIUM_LENGTH_32KIB + rnd.nextInt(MEDIUM_LENGTH_64KIB)];
        rnd.nextBytes(buf);

        final ByteBuffer bb = ByteBuffer.wrap(buf);
        while (bb.hasRemaining()) {
            final byte[] iu = new byte[Math.min(bb.remaining(), rnd.nextInt(4))];
File Line
app/keve/ktlsh/impl/TLSHDigest5.java 44
app/keve/ktlsh/impl/TLSHDigest5c1.java 44
        super(WINDOW_LENGTH, bucketCount, checkSumLength);
    }

    @Override
    public void update(final ByteBuffer buf) {
        while (count < windowLength - 1 && buf.hasRemaining()) {
            final int l0 = buf.get() & 0xFF;
            count++;
            lag <<= 8;
            lag |= l0;
            if (!buf.hasRemaining()) {
                return;
            }
        }
        int l1 = lag & 0xFF;
        int l2 = lag >>> 8 & 0xFF;
        int l3 = lag >>> 16 & 0xFF;
        int l4 = lag >>> 24 & 0xFF;
        while (buf.hasRemaining()) {
            final int l0 = buf.get() & 0xFF;
            count++;
File Line
app/keve/ktlsh/impl/TLSHDigest7.java 43
app/keve/ktlsh/impl/TLSHDigest8.java 42
    public TLSHDigest7(final int bucketCount, final int checkSumLength) {
        super(WINDOW_LENGTH, bucketCount, checkSumLength);
    }

    @Override
    public void update(final ByteBuffer buf) {
        int l1 = (int) (lag & 0xFF);
        int l2 = (int) (lag >>> 8 & 0xFF);
        int l3 = (int) (lag >>> 16 & 0xFF);
        int l4 = (int) (lag >>> 24 & 0xFF);
        int l5 = (int) (lag >>> 32 & 0xFF);
        int l6 = (int) (lag >>> 40 & 0xFF);
File Line
app/keve/ktlsh/impl/TLSHDigest4.java 60
app/keve/ktlsh/impl/TLSHDigest5.java 69
                case 3:
                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
                    checksum[1] = bMapping(checksum[0], l0, l1, checksum[1]);
                    checksum[2] = bMapping(checksum[1], l0, l1, checksum[2]);
                    break;
                default:
//                    checksum[0] = sMapping(T0, l0, l1, checksum[0]);
//                    for (int k = 1; k < checksum.length; k++) {
//                        checksum[k] = bMapping(checksum[k - 1], l0, l1, checksum[k]);
//                    }
//                    break;
                    throw new IllegalArgumentException("impossible");
                }

                aBucket[sMapping(T2, l0, l1, l2)]++;
                aBucket[sMapping(T3, l0, l1, l3)]++;
                aBucket[sMapping(T5, l0, l2, l3)]++;
File Line
app/keve/ktlsh/impl/TLSHDigest7.java 103
app/keve/ktlsh/impl/TLSHDigest8.java 111
        lag = l6 << 40 | l5 << 32 | l4 << 24 | l3 << 16 | l2 << 8 | l1;
    }

    @Override
    protected int[] getLag() {
        return new int[] {(int) (lag & 0xFF), (int) (lag >>> 8 & 0xFF), (int) (lag >>> 16 & 0xFF),
                (int) (lag >>> 24 & 0xFF), (int) (lag >>> 32 & 0xFF), (int) (lag >>> 40 & 0xFF)};
File Line
app/keve/ktlsh/impl/TLSHDigest6.java 43
app/keve/ktlsh/impl/TLSHDigest7.java 43
app/keve/ktlsh/impl/TLSHDigest8.java 42
    public TLSHDigest6(final int bucketCount, final int checkSumLength) {
        super(WINDOW_LENGTH, bucketCount, checkSumLength);
    }

    @Override
    public void update(final ByteBuffer buf) {
        int l1 = (int) (lag & 0xFF);
        int l2 = (int) (lag >>> 8 & 0xFF);
        int l3 = (int) (lag >>> 16 & 0xFF);
        int l4 = (int) (lag >>> 24 & 0xFF);
        int l5 = (int) (lag >>> 32 & 0xFF);