CSC407F/2103F Assignment 2
Due: November 22nd, 2004 at 7:00 pm
(the start of the lecture - anything handed in past the time the marking TA leaves the classroom will be considered late).

Create an Object-Oriented Design and an Object-Oriented Program in Java that flattens electronics schematics for transfer to PCB layout. The program will be run as follows and will write its results to standard output.

	    java Flatten inputfile 
	
The input is a text file in a specific format (detailed below) containing a top-level circuit and zero or more sub-circuits. For this assignment we will drop the multi-page, hierarchical block, variants, and net min width and max length requirements. The output will be in a similar format, but with all nested circuits flattened, and all components replaced by footprints.

You are to hand in an OOD in the style of the example presented in class. It will combine UML diagrams and written text. Be sure to divide your UML into readable chunks. The UML must include one or more sequence diagrams in addition to the necessary class and object diagrams. You are also to hand in the corresponding fully-documented (using Javadoc plus inline comments) and fully-functional Java program that implements this assignment. You should print out both the Javadoc and the program listings neatly to hand in. Also develop a number of test cases and hand in listings of inputs and corresponding outputs.

Part of the mark will be based on your use of design patterns. Use as many design patterns as are appropriate. In your OOD, identify your use of patterns by name and explain the benefits that using the design pattern brings in each particular instance.

The grammar for the input file and the output file is as follows.

	  inputfile: Refdesmap {Circuit}+
	  outputfile: {Footprint}+

	  Refdesmap: Refdesmap\n { {refdes.}id refdes\n}\n

	  Circuit: Circuit name\n {Connector\n}* {Component\n|Subcircuit\n}*}\n
	  
	  Component: Component id type [group] {net}+
	  Subcircuit: Subcircuit name refdes {net}+
	  Connector: Connector net

	  Footprint: Footprint footprint {refdes|-}+ {{refdes.}net}+

	  id: digit{digit}
	  name: letter{letter|digit}
	  group: letter{letter|digit}
	  refdes: letter{letter|digit}
	  footprint: letter{letter|digit}
	  net: {letter|digit}+