@Override protected MutableString getTerm(final int index, final MutableString s) { ensureStream(); // We perform a binary search to find the block to which s could possibly belong. int block = Arrays.binarySearch(blockStart, index); if (block < 0) block = - block - 2; try { dumpStream.position(blockOffset[block] * blockSize); dumpStream.readBits(0); iteratorIsUsable = false; int suffixLength, prefixLength = -1; for(int i = index - blockStart[block] + 1; i-- != 0;) { if (prefixLength < 0) prefixLength = 0; else prefixLength = dumpStream.readUnary(); suffixLength = dumpStream.readUnary(); s.delete(prefixLength, s.length()); s.length(prefixLength + suffixLength); for(int j = 0; j < suffixLength; j++) s.charAt(j + prefixLength, symbol2char[decoder.decode(dumpStream)]); } return s; } catch(IOException rethrow) { throw new RuntimeException(rethrow); } }
protected MutableString getTerm( final int index, final MutableString s ) { ensureStream(); // We perform a binary search to find the block to which s could possibly belong. int block = Arrays.binarySearch( blockStart, index ); if ( block < 0 ) block = - block - 2; try { dumpStream.position( blockOffset[ block ] * blockSize ); dumpStream.readBits( 0 ); iteratorIsUsable = false; int suffixLength, prefixLength = -1; for( int i = index - blockStart[ block ] + 1; i-- != 0; ) { if ( prefixLength < 0 ) prefixLength = 0; else prefixLength = dumpStream.readUnary(); suffixLength = dumpStream.readUnary(); s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for( int j = 0; j < suffixLength; j++ ) s.charAt( j + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); } return s; } catch( IOException rethrow ) { throw new RuntimeException( rethrow ); } }
protected MutableString getTerm( final int index, final MutableString s ) { ensureStream(); // We perform a binary search to find the block to which s could possibly belong. int block = Arrays.binarySearch( blockStart, index ); if ( block < 0 ) block = - block - 2; try { dumpStream.position( blockOffset[ block ] * blockSize ); dumpStream.readBits( 0 ); iteratorIsUsable = false; int suffixLength, prefixLength = -1; for( int i = index - blockStart[ block ] + 1; i-- != 0; ) { if ( prefixLength < 0 ) prefixLength = 0; else prefixLength = dumpStream.readUnary(); suffixLength = dumpStream.readUnary(); s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for( int j = 0; j < suffixLength; j++ ) s.charAt( j + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); } return s; } catch( IOException rethrow ) { throw new RuntimeException( rethrow ); } }
public CharSequence next() { if ( ! hasNext() ) throw new NoSuchElementException(); try { final int prefixLength; if ( index == blockStart[ currBlock + 1 ] ) { if ( dumpStream.readBits() % blockSize != 0 ) dumpStream.skip( blockSize - dumpStream.readBits() % blockSize ); currBlock++; prefixLength = 0; } else prefixLength = dumpStream.readUnary(); final int suffixLength = dumpStream.readUnary(); s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for ( int i = 0; i < suffixLength; i++ ) s.charAt( i + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); index++; return s; } catch ( IOException e ) { throw new RuntimeException( e ); } }
public CharSequence next() { if ( ! hasNext() ) throw new NoSuchElementException(); try { final int prefixLength; if ( index == blockStart[ currBlock + 1 ] ) { if ( dumpStream.readBits() % blockSize != 0 ) dumpStream.skip( blockSize - dumpStream.readBits() % blockSize ); currBlock++; prefixLength = 0; } else prefixLength = dumpStream.readUnary(); final int suffixLength = dumpStream.readUnary(); s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for ( int i = 0; i < suffixLength; i++ ) s.charAt( i + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); index++; return s; } catch ( IOException e ) { throw new RuntimeException( e ); } }
@Override public CharSequence next() { if (! hasNext()) throw new NoSuchElementException(); try { final int prefixLength; if (index == blockStart[currBlock + 1]) { if (dumpStream.readBits() % blockSize != 0) dumpStream.skip(blockSize - dumpStream.readBits() % blockSize); currBlock++; prefixLength = 0; } else prefixLength = dumpStream.readUnary(); final int suffixLength = dumpStream.readUnary(); s.delete(prefixLength, s.length()); s.length(prefixLength + suffixLength); for (int i = 0; i < suffixLength; i++) s.charAt(i + prefixLength, symbol2char[decoder.decode(dumpStream)]); index++; return s; } catch (IOException e) { throw new RuntimeException(e); } }
@Override public CharSequence next() { if (! hasNext()) throw new NoSuchElementException(); try { final int prefixLength; if (index == LongBigArrays.get(blockStart, currBlock + 1)) { if (dumpStream.readBits() % blockSize != 0) dumpStream.skip(blockSize - dumpStream.readBits() % blockSize); currBlock++; prefixLength = 0; } else prefixLength = dumpStream.readUnary(); final int suffixLength = dumpStream.readUnary(); s.delete(prefixLength, s.length()); s.length(prefixLength + suffixLength); for (int i = 0; i < suffixLength; i++) s.charAt(i + prefixLength, symbol2char[decoder.decode(dumpStream)]); index++; return s; } catch (IOException e) { throw new RuntimeException(e); } }
while (ibs.readBits() < codeLength) { decoder.decode(ibs);
while (ibs.readBits() < codeLength) { decoder.decode(ibs);
s.delete(prefixLength, s.length()); s.length(prefixLength + suffixLength); for(int j = 0; j < suffixLength; j++) s.charAt(j + prefixLength, symbol2char[decoder.decode(dumpStream)]);
while (ibs.readBits() < codeLength) { decoder.decode(ibs);
while (ibs.readBits() < codeLength) { decoder.decode(ibs);
s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for( int i = 0; i < suffixLength; i++ ) s.charAt( i + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); if ( s.equals( term ) ) return count; count++;
s.delete( prefixLength, s.length() ); s.length( prefixLength + suffixLength ); for( int i = 0; i < suffixLength; i++ ) s.charAt( i + prefixLength, symbol2char[ decoder.decode( dumpStream ) ] ); if ( s.equals( term ) ) return count; count++;
s.delete(prefixLength, s.length()); s.length(prefixLength + suffixLength); for(int i = 0; i < suffixLength; i++) s.charAt(i + prefixLength, symbol2char[decoder.decode(dumpStream)]); if (s.equals(term)) return count; count++;
final int symbol = decoder.decode(ibs);