pmp
Class InputQueue

java.lang.Object
  extended by pmp.Macroprocessor.Component
      extended by pmp.InputQueue

public final class InputQueue
extends Macroprocessor.Component

Internal structure of macroprocessor which provides input source for parser.

Title: PMP: Macroprocessor

Description: Java macroprocessor

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Luděk Hlaváček

Constructor Summary
InputQueue(Macroprocessor mp)
           
 
Method Summary
(package private)  void commit()
          Throws away all characters processed by getChar().
(package private)  void commit(int length)
          Throws away first length characters processed by getChar().
(package private)  int getCommittedBytes()
           
 int getChar()
          Reads single character from input.
 boolean isEmpty()
          Returns true when input queue is empty.
 InputSource pushBack(java.lang.CharSequence data)
           
 InputSource pushBack(InputSource data)
           
 InputSource pushFront(java.lang.CharSequence data)
          Adds new source in front of queue.
 InputSource pushFront(InputSource data)
          Adds new source in front of queue.
 void reset()
          Clears input queue and closes InputSource objects and all input buffers
 
Methods inherited from class pmp.Macroprocessor.Component
error, getMP, getMPAnalyzer, getMPIO, getMPIQ, getMPMacros, notice, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputQueue

public InputQueue(Macroprocessor mp)
Method Detail

pushFront

public InputSource pushFront(InputSource data)
Adds new source in front of queue.

Note: Prefetch queue must be empty.

Parameters:
data - source object

pushFront

public InputSource pushFront(java.lang.CharSequence data)
Adds new source in front of queue. Given CharSequence is encapsulated by StringInputSource class and pushFront(InputSource) is called.

Note: Prefetch must be empty.

Parameters:
data - source object
Returns:
newly created object implementing InputSource interface

pushBack

public InputSource pushBack(InputSource data)

pushBack

public InputSource pushBack(java.lang.CharSequence data)

getChar

public int getChar()
Reads single character from input.

Returns:
next character from input, or -1 if end of stream encountered

commit

void commit()
Throws away all characters processed by getChar().


commit

void commit(int length)
Throws away first length characters processed by getChar(). Remaining characters are returned to InputQueue.

Parameters:
length - number of characters to be committed

getCommittedBytes

int getCommittedBytes()

isEmpty

public boolean isEmpty()
Returns true when input queue is empty. While there is a InputSource object in queue, it tries to read some data from it. This method might block (eg: if input is connected to console).

Returns:
true if there is not any character available

reset

public void reset()
Clears input queue and closes InputSource objects and all input buffers

See Also:
InputSource