package lrs.visitor;

import lrs.*;

import java.awt.*;

// This visitor prints (by appending) a LRS made of CompareObjecs

// onto a TextArea AWT object.  

// It does not clear the text area before writing to it.

// Returns null always.

public class LRSPrint

 implements IAlgo

{

 /** @SBGen Constructor   */

 public LRSPrint()

 {

  }



    public Object emptyCase(LRStruct host, Object... param)

    {

        return(null);   // Nothing to print here.

    }



    public Object nonEmptyCase(LRStruct host, Object... param)

    {

        TextArea device = (TextArea) param[0];  // saves recasting all the time

  // appends the integer value of the data as a new line onto the TextArea

  device.append(((Integer)host.getFirst()).toString() +'\n');

  return host.getRest().execute(this,device);  // recurse on the rest of the list

    }

}