/**
  * Receive as many items as possible from the given byte buffer to this buffer.
  *
  * <p>The <TT>receiveItems()</TT> method must not block the calling thread; if it does, all
  * message I/O in MP will be blocked.
  *
  * @param i Index of first item to receive, in the range 0 .. <TT>length</TT>-1.
  * @param num Maximum number of items to receive.
  * @param buffer Byte buffer.
  * @return Number of items received.
  */
 protected int receiveItems(int i, int num, ByteBuffer buffer) {
   CharBuffer charbuffer = buffer.asCharBuffer();
   int n = 0;
   int r = i / myColCount;
   int row = r + myLowerRow;
   int c = i % myColCount;
   int col = c + myLowerCol;
   int ncols = Math.min(myColCount - c, charbuffer.remaining());
   while (r < myRowCount && ncols > 0) {
     char[] myMatrix_row = myMatrix[row];
     while (c < ncols) {
       myMatrix_row[col] = myOp.op(myMatrix_row[col], charbuffer.get());
       ++c;
       ++col;
     }
     n += ncols;
     ++r;
     ++row;
     c = 0;
     col = myLowerCol;
     ncols = Math.min(myColCount, charbuffer.remaining());
   }
   buffer.position(buffer.position() + 2 * n);
   return n;
 }
 /**
  * Store the given item in this buffer.
  *
  * <p>The <TT>put()</TT> method must not block the calling thread; if it does, all message I/O in
  * MP will be blocked.
  *
  * @param i Item index in the range 0 .. <TT>length()</TT>-1.
  * @param item Item to be stored at index <TT>i</TT>.
  */
 public void put(int i, char item) {
   int row = (i / myColCount) + myLowerRow;
   int col = (i % myColCount) + myLowerCol;
   myMatrix[row][col] = myOp.op(myMatrix[row][col], item);
 }