private void insertAtBranchValueAlt(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int insertLength = sourceLength - length; assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } else { final int insertLength = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(r1, pos, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } }
assert(sourceLength1>=1); writeEnd(writeRuns(insertAltBranch(0, pos-1, source, sourcePos1, sourceLength1, sourceMask), source, sourcePos1, sourceLength1, sourceMask), value); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthNumericCapture, sourceMask), source, sourcePos, insertLengthNumericCapture, sourceMask), value); return; assert(insertLengthBytesCapture>=1); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthBytesCapture, sourceMask), source, sourcePos, insertLengthBytesCapture, sourceMask), value); limit = Math.max(limit, writeEnd(pos, value));
assert(sourceLength1>=1); writeEnd(writeRuns(insertAltBranch(0, pos-2, source, sourcePos, sourceLength1, sourceMask), source, sourcePos, sourceLength1, sourceMask), value); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); data[idx+1] = (short)(0x7FFF&(indexJump)); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); writeEnd(writeRuns(newPos, source, sourcePos, sourceLength1, sourceMask), value); limit = writeEnd(writeRuns(newPos, source, sourcePos, sourceLength1, sourceMask), value); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthNumericCapture, sourceMask), source, sourcePos, insertLengthNumericCapture, sourceMask), value); return; assert(insertLengthBytesCapture>=1); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthBytesCapture, sourceMask), source, sourcePos, insertLengthBytesCapture, sourceMask), value); limit = Math.max(limit, writeEnd(pos, value));
private void insertAtBranchValueAlt(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int insertLength = sourceLength - length; assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } else { final int insertLength = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(r1, pos, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } }
assert(sourceLength1>=1); writeEnd(writeRuns(insertAltBranch(0, pos-2, source, sourcePos, sourceLength1, sourceMask), source, sourcePos, sourceLength1, sourceMask), value); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); data[idx+1] = (short)(0x7FFF&(indexJump)); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); limit = writeEnd(writeRuns(limit, source, sourcePos, sourceLength-length, sourceMask), value); writeEnd(writeRuns(newPos, source, sourcePos, sourceLength1, sourceMask), value); limit = writeEnd(writeRuns(newPos, source, sourcePos, sourceLength1, sourceMask), value); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthNumericCapture, sourceMask), source, sourcePos, insertLengthNumericCapture, sourceMask), value); return; assert(insertLengthBytesCapture>=1); writeEnd(writeRuns(appendAltBranch(pos-1, source, sourcePos, insertLengthBytesCapture, sourceMask), source, sourcePos, insertLengthBytesCapture, sourceMask), value); limit = Math.max(limit, writeEnd(pos, value));
private void insertAtBranchValueAlt(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int insertLength = sourceLength - length; assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } else { final int insertLength = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(insertLength>=1); writeEnd(writeRuns(insertAltBranch(r1, pos, source, sourceCharPos, insertLength, sourceMask), source, sourceCharPos, insertLength, sourceMask), value); } }
private void insertAtBranchValueByte(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int sourceLength1 = sourceLength - length; assert(sourceLength1>=1); writeEnd(writeRuns(insertByteBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, sourceLength1, sourceMask), source, sourceCharPos, sourceLength1, sourceMask), value); } else { final int sourceLength1 = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(sourceLength1>=1); writeEnd(writeRuns(insertByteBranch(r1, pos-1, source, sourceCharPos, sourceLength1, sourceMask), source, sourceCharPos, sourceLength1, sourceMask), value); } }
private void insertAtBranchValueByte(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int sourceLength1 = sourceLength - length; assert(sourceLength1>=1); int insertByteBranch = insertBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, sourceLength1, sourceMask); writeEnd(writeRuns(insertByteBranch, source, sourceCharPos, sourceLength1, sourceMask), value); } else { final int sourceLength1 = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(sourceLength1>=1); int insertByteBranch = insertBranch(r1, pos-1, source, sourceCharPos, sourceLength1, sourceMask); writeEnd(writeRuns(insertByteBranch, source, sourceCharPos, sourceLength1, sourceMask), value); } }
private void insertAtBranchValueByte(final int pos, byte[] source, int sourceLength, int sourceMask, long value, int length, int runPos, int run, int r1, final int sourceCharPos) { r1++; if (r1 == run) { final int sourceLength1 = sourceLength - length; assert(sourceLength1>=1); int insertByteBranch = insertBranch(0, pos>=3 ? pos-3 : 0, source, sourceCharPos, sourceLength1, sourceMask); writeEnd(writeRuns(insertByteBranch, source, sourceCharPos, sourceLength1, sourceMask), value); } else { final int sourceLength1 = sourceLength - (length+(data[runPos] = (short)(run-r1))); assert(sourceLength1>=1); int insertByteBranch = insertBranch(r1, pos-1, source, sourceCharPos, sourceLength1, sourceMask); writeEnd(writeRuns(insertByteBranch, source, sourceCharPos, sourceLength1, sourceMask), value); } }
private void convertEndToNewSafePoint(int pos, byte[] source, int sourcePos, int sourceLength, int sourceMask, long value) { //convert end to safe, pos is now at the location of SIZE_OF_RESULT data if (data[pos-1] != TYPE_END) { throw new UnsupportedOperationException(); } data[--pos] = TYPE_SAFE_END; //change to a safe and move pos back to beginning of this. //now insert the needed run int requiredRoom = SIZE_OF_END_1 + sourceLength + midRunEscapeValuesSizeAdjustment(source, sourcePos, sourceLength, sourceMask); //TODO: bad req room, add to end instead we do not know right length... makeRoomForInsert(0, pos, requiredRoom); //after the safe point we make room for our new run and end pos += SIZE_OF_SAFE_END; pos = writeRuns(pos, source, sourcePos, sourceLength, sourceMask); pos = writeEnd(pos, value); }
private void convertEndToNewSafePoint(int pos, byte[] source, int sourcePos, int sourceLength, int sourceMask, long value) { //convert end to safe, pos is now at the location of SIZE_OF_RESULT data if (data[pos-1] != TYPE_END) { throw new UnsupportedOperationException(); } data[--pos] = TYPE_SAFE_END; //change to a safe and move pos back to beginning of this. //now insert the needed run int requiredRoom = SIZE_OF_END_1 + sourceLength + midRunEscapeValuesSizeAdjustment(source, sourcePos, sourceLength, sourceMask); makeRoomForInsert(0, pos, requiredRoom); //after the safe point we make room for our new run and end pos += SIZE_OF_SAFE_END; pos = writeRuns(pos, source, sourcePos, sourceLength, sourceMask); pos = writeEnd(pos, value); }
private void convertEndToNewSafePoint(int pos, byte[] source, int sourcePos, int sourceLength, int sourceMask, long value) { //convert end to safe, pos is now at the location of SIZE_OF_RESULT data if (data[pos-1] != TYPE_END) { throw new UnsupportedOperationException(); } data[--pos] = TYPE_SAFE_END; //change to a safe and move pos back to beginning of this. //now insert the needed run int requiredRoom = SIZE_OF_END_1 + sourceLength + midRunEscapeValuesSizeAdjustment(source, sourcePos, sourceLength, sourceMask); //TODO: bad req room, add to end instead we do not know right length... makeRoomForInsert(0, pos, requiredRoom); //after the safe point we make room for our new run and end pos += SIZE_OF_SAFE_END; pos = writeRuns(pos, source, sourcePos, sourceLength, sourceMask); pos = writeEnd(pos, value); }