Building Parsers with Java

sjm.imperative
Class PrintlnCommand

java.lang.Object
  |
  +--sjm.imperative.Command
        |
        +--sjm.imperative.PrintlnCommand

public class PrintlnCommand
extends Command

This command, when executed, prints out the value of a term provided in the constructor.


Field Summary
protected  java.io.PrintWriter out
           
protected  Term term
           
 
Constructor Summary
PrintlnCommand(Term term)
          Construct a "print" command to print the supplied term.
PrintlnCommand(Term term, java.io.PrintWriter out)
          Construct a "print" command to print the supplied term, printing to the supplied PrintWriter object.
 
Method Summary
 void execute()
          Print the value of this object's term onto the output writer.
 java.lang.String toString()
          Returns a string description of this print command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

term

protected Term term

out

protected java.io.PrintWriter out
Constructor Detail

PrintlnCommand

public PrintlnCommand(Term term)
Construct a "print" command to print the supplied term.
Parameters:
Term - the term to print

PrintlnCommand

public PrintlnCommand(Term term,
                      java.io.PrintWriter out)
Construct a "print" command to print the supplied term, printing to the supplied PrintWriter object.
Parameters:
Term - the term to print
PrintWriter - where to print
Method Detail

execute

public void execute()
Print the value of this object's term onto the output writer.
Overrides:
execute in class Command

toString

public java.lang.String toString()
Returns a string description of this print command.
Overrides:
toString in class java.lang.Object
Returns:
a string description of this print command

by Steve Metsker