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 inputfileThe 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}+
Below is an example of a sample input file along with its corresponding correct output.
The only component types and footprints you must handle in your program are those given in this example (i.e., your symbol/footprint database has only 3 symbols and 3 footprints). Implement this "database" entirely in memory, but with appropriate interfaces so that a relational database could be substituted at some future time without modifying the client code.
For your dummy "in-memory" database, implement it in such a way that you can dynamically load new component types and footprints types at run-time by dropping the appropriate ".class" files into a directory on your classpath and specifying classes to load in a config file (one classname per line). Note, no information other than the classname should be given in this config file. The six must-have database items must be implemented in this manner. If the config file is absent, load the must-have components only (hardwire their classnames as defaults in the case of a missing config, but still load them dynamically).
Input: Refdesmap 1 R1 X1.1 C1 X1.X1.1 R2 X1.X1.2 N1 X1.X2.1 R3 X1.X2.2 N2 X2.1 C2 X2.X1.1 R4 X2.X1.2 N3 X2.X2.1 R5 X2.X2.2 N4 Circuit TLC Component 1 Resistor1k Vcc 1 Subcircuit sub1 X1 1 2 Subcircuit sub1 X2 2 0 Circuit sub1 Connector 1 Connector 2 Component 1 Capacitor10uF 1 2 Subcircuit sub2 X1 1 2 Subcircuit sub2 X2 1 2 Circuit sub2 Connector 1 Connector 3 Component 1 Resistor1k 1 2 Component 2 7400N NAND 0 Vcc 2 2 3
Output: Footprint RES0.5 R1 Vcc 1 Footprint RES0.5 R2 1 X1.X1.2 Footprint RES0.5 R3 1 X1.X2.2 Footprint RES0.5 R4 2 X2.X1.2 Footprint RES0.5 R5 2 X2.X2.2 Footprint CAP5 C1 1 2 Footprint CAP5 C2 2 0 Footprint NO14 N1 N2 N3 N4 Vcc X1.X1.2 X1.X1.2 2 X1.X2.2 X1.X2.2 2 X2.X1.2 X2.X1.2 0 X2.X2.2 X2.X2.2 0 0