Exemplo n.º 1
0
  //  Write an item to the pipe.  Don't flush it yet. If incomplete is
  //  set to true the item is assumed to be continued by items
  //  subsequently written to the pipe. Incomplete items are never
  //  flushed down the stream.
  public final void write(final T value_, boolean incomplete_) {
    //  Place the value to the queue, add new terminator element.
    queue.push(value_);

    //  Move the "flush up to here" poiter.
    if (!incomplete_) {
      f = queue.back_pos();
    }
  }
Exemplo n.º 2
0
  //  Pop an incomplete item from the pipe. Returns true is such
  //  item exists, false otherwise.
  public T unwrite() {

    if (f == queue.back_pos()) return null;
    queue.unpush();
    return queue.back();
  }
Exemplo n.º 3
0
 public YPipe(int qsize) {
   queue = new YQueue<T>(qsize);
   w = r = f = queue.back_pos();
   c = new AtomicInteger(queue.back_pos());
 }