001    package lrs.visitor;
002    import lrs.*;
003    import java.awt.*;
004    // This visitor prints (by appending) a LRS made of CompareObjecs
005    // onto a TextArea AWT object.  
006    // It does not clear the text area before writing to it.
007    // Returns null always.
008    public class LRSPrint
009     implements IAlgo
010    {
011     /** @SBGen Constructor   */
012     public LRSPrint()
013     {
014      }
015    
016        public Object emptyCase(LRStruct host, Object... param)
017        {
018            return(null);   // Nothing to print here.
019        }
020    
021        public Object nonEmptyCase(LRStruct host, Object... param)
022        {
023            TextArea device = (TextArea) param[0];  // saves recasting all the time
024      // appends the integer value of the data as a new line onto the TextArea
025      device.append(((Integer)host.getFirst()).toString() +'\n');
026      return host.getRest().execute(this,device);  // recurse on the rest of the list
027        }
028    }