/*  CSI2114 Lab 4 - Sentence.java
 *  
 *  A driver program to test the implementation of the Sequence.
 *
 *  Usage: java Sentence
 *  
 *  by Jeff Souza (adapted from ...)
 *
 */

class Sentence {
    public static void main (String args[]) {

        // Construct a sample sentence.
        Sequence sentence = new NodeSequence();

        // INSERT CODE HERE

        // Now deconstruct the sentence.
        // INSERT CODE HERE
        if ( sentence.isEmpty())
            System.out.println("\nThe sentence is now empty.");

        System.out.println("\nLet's end by throwing an exception:");
        // INSERT CODE HERE
 }


    public static void printSentence( Sequence sentence ) {
        // Display the current sentence.
        Position pos = sentence.first();
        for ( int i = 1; i < sentence.size(); i++ ) {
            System.out.print( pos.element());
            pos = sentence.after( pos );
        }
        System.out.println( pos.element());
    }

}
