@Override public long longestCommonPrefixLength(final BitVector v) { if (v instanceof LongArrayBitVector) return longestCommonPrefixLength((LongArrayBitVector)v); return super.longestCommonPrefixLength(v); }
public long longestCommonPrefixLength( final BitVector v ) { if ( v instanceof LongArrayBitVector ) return longestCommonPrefixLength( (LongArrayBitVector)v ); return super.longestCommonPrefixLength( v ); }
public long longestCommonPrefixLength( final BitVector v ) { if ( v instanceof LongArrayBitVector ) return longestCommonPrefixLength( (LongArrayBitVector)v ); return super.longestCommonPrefixLength( v ); }
/** Returns true if this node is the exit node of a string. * * @param v the string. * @param transform the transformation strategy used to build the trie this node belongs to. * @return true if the string exits at this node. */ public boolean isExitNodeOf(final LongArrayBitVector v, TransformationStrategy<? super U> transform) { return isExitNodeOf(v.length(), v.longestCommonPrefixLength(extent(transform)), transform); }
/** Returns the exit node of a given bit vector. * * @param v a bit vector. * @param state the hash state of <code>v</code> precomputed by {@link Hashes#preprocessMurmur(BitVector, long)}. * @return the exit node of <code>v</code>. */ private ExitData<T> getExitNode(final LongArrayBitVector v, final long[] state) { if (size == 0) throw new IllegalStateException(); if (size == 1) return new ExitData<>(root, v.longestCommonPrefixLength(root.extent(transform))); if (DDEBUG) System.err.println("getExitNode(" + v + ")"); final long length = v.length(); // This can be the exit node of v, the parex node of v, or something completely wrong. InternalNode<T> parexOrExitNode = fatBinarySearch(v, state, null, false, -1, length); // This will contain the exit node if parexOrExitNode contains the correct parex node. Node<T> candidateExitNode = parexOrExitNode.extentLength < length && v.getBoolean(parexOrExitNode.extentLength) ? parexOrExitNode.right : parexOrExitNode.left; /* This lcp length makes it possible to compute the length of the lcp between v and * parexOrExitNode by minimisation with the extent length, as necessarily the extent of * candidateExitNode is an extension of the extent of parexOrExitNode. */ long lcpLength = v.longestCommonPrefixLength(candidateExitNode.extent(transform)); // In this case the fat binary search gave us the correct parex node. if (candidateExitNode.isExitNodeOf(length, lcpLength, transform)) return new ExitData<>(candidateExitNode, lcpLength); // In this case the fat binary search gave us the correct exit node. lcpLength = Math.min(parexOrExitNode.extentLength, lcpLength); if (parexOrExitNode.isExitNodeOf(length, lcpLength, transform)) return new ExitData<>(parexOrExitNode, lcpLength); // Otherwise, something went horribly wrong. We restart in exact mode. parexOrExitNode = fatBinarySearch(v, state, null, true, -1, length); candidateExitNode = parexOrExitNode.extent(transform).isProperPrefix(v) ? parexOrExitNode.extentLength < length && v.getBoolean(parexOrExitNode.extentLength) ? parexOrExitNode.right : parexOrExitNode.left : parexOrExitNode; return new ExitData<>(candidateExitNode, v.longestCommonPrefixLength(candidateExitNode.extent(transform))); }
delimiterLcp = (rightDelimiter != null && leftDelimiter != null) ? rightDelimiter.longestCommonPrefixLength(leftDelimiter) : -1; final int prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free"); maxDescentLength = rightDelimiter.longestCommonPrefixLength(curr) + 1; exitLeft = true; maxDescentLength = leftDelimiter.longestCommonPrefixLength(curr) + 1; exitLeft = false; else maxDescentLength = (exitLeft = curr.getBoolean(delimiterLcp)) ? rightDelimiter.longestCommonPrefixLength(curr) + 1 : leftDelimiter.longestCommonPrefixLength(curr) + 1;
chunkedHashStore.add(curr); pl.lightUpdate(); final int prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free");
if (DDEBUG) System.err.println("getParentExitNode(" + v + ")"); if (size == 0) throw new IllegalStateException(); if (size == 1) return new ParexData<>(null, root, v.longestCommonPrefixLength(root.extent(transform))); final long length = v.length(); long lcpLength = v.longestCommonPrefixLength(candidateExitNode.extent(transform)); if (ASSERTS) assert lcpLength == v.longestCommonPrefixLength(parexOrExitNode.extent(transform)); parexOrExitNode = fatBinarySearch(v, state, stack, true, -1, length); candidateExitNode = parexOrExitNode.extentLength < length && v.getBoolean(parexOrExitNode.extentLength) ? parexOrExitNode.right : parexOrExitNode.left; lcpLength = v.longestCommonPrefixLength(candidateExitNode.extent(transform));
prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free"); prefix = (int)prev.longestCommonPrefixLength(prevDelimiter); if (! first) { prefix = (int)prev.longestCommonPrefixLength(curr); while(last > 0 && len[last] > prefix) last--;
chunkedHashStore.add(curr); pl.lightUpdate(); final int prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct@" + (b * bucketSize + i) + " (\"" + curr + "\" = \"" + prev + "\")"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free@" + (b * bucketSize + i) + " (\"" + curr + "\" is a prefix or a suffix of \"" + prev + "\")");
prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free"); prefix = (int)shortest.longestCommonPrefixLength(prevDelimiter); if (! first) { prefix = (int)prev.longestCommonPrefixLength(curr); while(depth > 0 && len[depth] > prefix) depth--;
chunkedHashStore.add(curr); pl.lightUpdate(); final int prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free");
prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free"); prefix = (int)prev.longestCommonPrefixLength(prevDelimiter); if (! first) { prefix = (int)prev.longestCommonPrefixLength(curr); while(depth > 0 && len[depth] > prefix) depth--;
if (maxLength < curr.length()) maxLength = curr.length(); totalLength += curr.length(); prefix = (int)curr.longestCommonPrefixLength(prev); if (prefix == prev.length() && prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not distinct"); if (prefix == prev.length() || prefix == curr.length()) throw new IllegalArgumentException("The input bit vectors are not prefix-free");