// OutputFormatter2 Class
/** created by:
 *              Jonathan Kensler
 *              Yaw A. Nti-Addae
 *              Patric Knoedler
 */

import OurSinglyLinkedList2;
import Terminal2;
import GUI2;

public class OutputFormatter2 {

    /** genOutput method receives results from the coordinator program
     * and formats them into a list.
     */
    public void genOutput (String schemeCode,
                             OurSinglyLinkedList2 list,
                             SchemeTesterInterface2 sender) {
        // parameters for the method are string, list and string
        // In formatting, \n is attached to the list at where ever
        // a newline should be.

        OurSinglyLinkedList2 ls = new OurSinglyLinkedList2();
        Terminal2 sender1 = new Terminal2();
        GUI2 sender2 = new GUI2();

        ls.add(schemeCode);
        ls.add("\n" + "\n");

        // while loop to go through the list and add them to ls

       SinglyLinkedListElement2 current = ls.head;

       while(current != null){
           ls.add("Results: ");
           ls.add(current);
           ls.add("\n");
           current = list.head.next();
           ls.add("Statics: ");
           ls.add(current);
           ls.add("\n");
           current = list.head.next();
       }//while

       // Sending the list to the interface.
       sender.printer(ls.toString());

    }//genOutput
}//OutputFormatter2()
