Class InputValidatorQueue

java.lang.Object
  extended by InputValidatorQueue

public class InputValidatorQueue
extends java.lang.Object

An input validation queue. Performs basic syntactic validation of enqueued items. Only valid items are available for dequeueing.


Constructor Summary
InputValidatorQueue()
          Construct an object of class InputValidatorQueue.
 
Method Summary
 java.lang.String dequeue()
          Dequeue an item if any exists in the queue.
 boolean enqueue(java.util.List<java.lang.String> inputStringList)
          Attempt to enqueue a list of strings.

Post-Conditions: All valid strings in the list are enqueued; no invalid strings are enqueued
 boolean enqueue(java.lang.String inputString)
          Attempt to enqueue a string.
 boolean isEmpty()
          Tests if this queue is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputValidatorQueue

public InputValidatorQueue()
Construct an object of class InputValidatorQueue.

Method Detail

enqueue

public boolean enqueue(java.lang.String inputString)
Attempt to enqueue a string. Note that if the string is not syntactically valid, it will not be enqueued.

Parameters:
inputString - the item to be enqueued
Returns:
true if the item was valid and thus enqueued; false otherwise

enqueue

public boolean enqueue(java.util.List<java.lang.String> inputStringList)
Attempt to enqueue a list of strings.

Post-Conditions: All valid strings in the list are enqueued; no invalid strings are enqueued

Parameters:
inputStringList - the list of strings to be enqueued
Returns:
true if all items in the list are valid; false if at least one item is not valid

dequeue

public java.lang.String dequeue()
Dequeue an item if any exists in the queue.

Returns:
the next item in the queue
Throws:
EmptyQueueException - if this queue is empty

isEmpty

public boolean isEmpty()
Tests if this queue is empty.

Returns:
true if this queue contains no items; false otherwise