Class GraphicsCompiler

java.lang.Object
  extended by GraphicsCompiler

public class GraphicsCompiler
extends Object

Class that reads in a file of graphics instructions, and then generates a NEW Java Program that does the same thing as the instructions. Default picture size is 640x480. Format of the file is a bunch of lines of the form: Command X Y Commands are "line" with parameters of end X,Y and "circle" with a parameter of diameter. For example: line 10 10 50 70 circle 10 20 30 Which draws a line from (10,10) to (50,70) and a circle at (10,20) with a diameter of 30.

Author:
Barb Ericson, Mark Guzdial

Constructor Summary
GraphicsCompiler()
           
 
Method Summary
 void compileCommands(String fileName)
          Method to compile the commands in the given file
static void main(String[] args)
           
 void writeEpilogue(BufferedWriter file)
          Method to write out the epilog for the new program: Show the picture.
 void writePrologue(BufferedWriter file)
          Method to write out the prolog for the new program: All the imports, the class definition, main, etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsCompiler

public GraphicsCompiler()
Method Detail

writePrologue

public void writePrologue(BufferedWriter file)
Method to write out the prolog for the new program: All the imports, the class definition, main, etc.

Parameters:
file - BufferedWriter to write the prologue to

writeEpilogue

public void writeEpilogue(BufferedWriter file)
Method to write out the epilog for the new program: Show the picture. Close the main and the class.

Parameters:
file - BufferedWriter to write the prologue to

compileCommands

public void compileCommands(String fileName)
Method to compile the commands in the given file


main

public static void main(String[] args)