TODO

@param pairIndex TODO
@param buffer TODO
@return TODO
14018
protected ExpectState prepareClosure(int pairIndex, String buffer) {
        ExpectState state;
        Map<String, Object> prevMap = null;
        if (g_state != null) {
            prevMap = g_state.getVars();
        }

        state = new ExpectState(pairIndex, buffer, prevMap);

        return state;
    }
693722
public static <T extends JCGLBufferWritableType> JCGLBufferUpdateType<T>
  newUpdateReplacingAll(final T buffer)
  {
    NullCheck.notNull(buffer, "Buffer");
    return newUpdateReplacingRange(buffer, buffer.byteRange());
  }
532467
public static String hexDump(ByteBuf buffer) {
        return hexDump(buffer, buffer.readerIndex(), buffer.readableBytes());
    }
718135
public static byte[] readArray(ReadableBuffer buffer) {
    Preconditions.checkNotNull(buffer, "buffer");
    int length = buffer.readableBytes();
    byte[] bytes = new byte[length];
    buffer.readBytes(bytes, 0, length);
    return bytes;
  }
853349
private String subQuery(ByteBuffer buffer) {
    String queryString;
    if (options.maxQuerySizeToLog == 0) {
      queryString = new String(buffer.array(), 5, buffer.limit());
    } else {
      queryString = new String(buffer.array(), 5,
          Math.min(buffer.limit() - 5, (options.maxQuerySizeToLog * 3)));
      if (queryString.length() > options.maxQuerySizeToLog - 3) {
        queryString = queryString.substring(0, options.maxQuerySizeToLog - 3) + "...";
      }
    }
    return queryString;
  }
1112080
public static IncrementalIndex makeIncrementalIndex(
      GroupByQuery query,
      GroupByQueryConfig config,
      NonBlockingPool<ByteBuffer> bufferPool,
      Sequence<Row> rows,
      boolean combine
  )
  {
    Pair<IncrementalIndex, Accumulator<IncrementalIndex, Row>> indexAccumulatorPair = GroupByQueryHelper.createIndexAccumulatorPair(
        query,
        config,
        bufferPool,
        combine
    );

    return rows.accumulate(indexAccumulatorPair.lhs, indexAccumulatorPair.rhs);
  }
1027055
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
    BitArray binary = BitArrayBuilder.buildBitArray(pairs);

    AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
    String resultingString = decoder.parseInformation();

    ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
    ResultPoint[] lastPoints  = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();

    return new Result(
          resultingString,
          null,
          new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
          BarcodeFormat.RSS_EXPANDED
      );
  }
646221
@Override
	public int indexOf(Pair<T, I> element) {
		return matrix.indexOf(
				transactionToIndex(element.transaction), 
				itemToIndex(element.item));
	}
564721
public void sendIndexToBuffer(String index, Map<String, List<String>> fields) {
		String doc = pyUtils.solrDocument(fields);
		addToBuffer(index, doc);
	}
891137
public static void boundsCheck(final byte[] buffer, final long index, final int length)
    {
        final int capacity = buffer.length;
        final long resultingPosition = index + (long)length;
        if (index < 0 || resultingPosition > capacity)
        {
            throw new IndexOutOfBoundsException("index=" + index + " length=" + length + " capacity=" + capacity);
        }
    }
861723
public ByteArray slice( int index, int length )
    {
        int oldLimit = bb.limit();
        bb.position( index );
        bb.limit( index + length );
        IoBuffer slice = bb.slice();
        bb.limit( oldLimit );
        return new BufferByteArray( slice )
        {

            @Override
            public void free()
            {
                // Do nothing.
            }
        };
    }
452681
public static String join(Iterator<? extends EncodedPair> pairs, char pairSep){
        return join(pairs, pairSep, '=', false, false);
    }
1295422
function indexOf(haystack, needle, i) {
    if (!Buffer.isBuffer(needle)) needle = new Buffer(needle);
    if (typeof i === 'undefined') i = 0;
    var l = haystack.length - needle.length + 1;
    while (i<l) {
      var good = true;
      for (var j=0, n=needle.length; j<n; j++) {
        if (haystack[i+j] !== needle[j]) {
          good = false;
          break;
        }
      }
      if (good) return i;
      i++;
    }
    return -1;
  }
73542
public static int[] shape(int[] buffer) {
        int[] ret = new int[rank(buffer)];
        System.arraycopy(buffer, 1, ret, 0, ret.length);
        return ret;
    }
644199
public Pair<Integer, List<ByteBuffer>> data(DataFrame frame, int maxLength) {
        return dataGenerator.generate(frame, maxLength);
    }
617432
public final Pair<Integer, Integer> pairNums() throws RecognitionException {
		Pair<Integer, Integer> pair = null;


		Token i=null;
		Token j=null;

		try {
			// druidG.g:356:2: ( ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) )
			// druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE )
			{
			// druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE )
			// druidG.g:356:5: LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE
			{
			match(input,LSQUARE,FOLLOW_LSQUARE_in_pairNums2489); 
			// druidG.g:356:13: ( WS )?
			int alt169=2;
			int LA169_0 = input.LA(1);
			if ( (LA169_0==WS) ) {
				alt169=1;
			}
			switch (alt169) {
				case 1 :
					// druidG.g:356:13: WS
					{
					match(input,WS,FOLLOW_WS_in_pairNums2491); 
					}
					break;

			}

			i=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2496); 
			// druidG.g:356:25: ( WS )?
			int alt170=2;
			int LA170_0 = input.LA(1);
			if ( (LA170_0==WS) ) {
				alt170=1;
			}
			switch (alt170) {
				case 1 :
					// druidG.g:356:25: WS
					{
					match(input,WS,FOLLOW_WS_in_pairNums2499); 
					}
					break;

			}

			match(input,91,FOLLOW_91_in_pairNums2502); 
			// druidG.g:356:33: ( WS )?
			int alt171=2;
			int LA171_0 = input.LA(1);
			if ( (LA171_0==WS) ) {
				alt171=1;
			}
			switch (alt171) {
				case 1 :
					// druidG.g:356:33: WS
					{
					match(input,WS,FOLLOW_WS_in_pairNums2504); 
					}
					break;

			}

			j=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2509); 
			// druidG.g:356:44: ( WS )?
			int alt172=2;
			int LA172_0 = input.LA(1);
			if ( (LA172_0==WS) ) {
				alt172=1;
			}
			switch (alt172) {
				case 1 :
					// druidG.g:356:44: WS
					{
					match(input,WS,FOLLOW_WS_in_pairNums2511); 
					}
					break;

			}

			match(input,RSQUARE,FOLLOW_RSQUARE_in_pairNums2514); 
			}

			 pair = new Pair<>(Integer.parseInt((i!=null?i.getText():null)), Integer.parseInt((j!=null?j.getText():null)));
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
		}
		return pair;
	}
1123988
final KeyValue<ByteBuffer, ByteBuffer> getKeyValueFromPointer(int index) {
    int origionalLimit = memoryBuffer.limit();
    memoryBuffer.limit(memoryBuffer.capacity());
    int pointerOffset = computePointerOffset(index);
    int keyPos =  memoryBuffer.getInt(pointerOffset);
    int valuePos =  memoryBuffer.getInt(pointerOffset + 4);
    int valueLength = memoryBuffer.getInt(pointerOffset + 8);
    memoryBuffer.limit(origionalLimit);
    assert valuePos >= keyPos;
    ByteBuffer key = sliceOutRange(keyPos, valuePos);
    ByteBuffer value = sliceOutRange(valuePos, valuePos + valueLength);
    return new KeyValue<>(key, value);
  }