Class GBXGenerator

java.lang.Object
  |
  +--GBXGenerator

public class GBXGenerator
extends java.lang.Object

The is a DOM-based GBX Generator. It is used to write macro and workspace files. Outputs DOM to a String using the DOM Serializer. Cool, huh?


Field Summary
(package private)  CircuitDiagram CD
          Our circuitDiagram
(package private)  org.w3c.dom.Document doc
          The document that we will be creating.
(package private)  GateBuilder gb
          Our very own GateBulder
(package private)  int type
          This tells us what we want to generate ( a workspace, a macro, or both)
 
Constructor Summary
(package private) GBXGenerator(CircuitDiagram newCD, GateBuilder newGB)
          Nominal Constructor.
 
Method Summary
 org.w3c.dom.Element connection2xml(GraphicGate obj, GraphicGate input)
          Takes two gates and generates an xml connection between them.
 org.w3c.dom.Element gate2xml(GraphicGate obj)
          Takes a gate and returns a dom object representing that gate.
 java.lang.String generate(boolean isMacro)
          This method actually generates the String.
 org.w3c.dom.Element macro2xml(Macro macro)
          Takes a macro object and returns a DOM element representing the objec.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

org.w3c.dom.Document doc
The document that we will be creating.

CD

CircuitDiagram CD
Our circuitDiagram

gb

GateBuilder gb
Our very own GateBulder

type

int type
This tells us what we want to generate ( a workspace, a macro, or both)
Constructor Detail

GBXGenerator

GBXGenerator(CircuitDiagram newCD,
             GateBuilder newGB)
Nominal Constructor.
Parameters:
newCD - The circuidiagram that we will use.
newGB - The gatebuilder to raise alters.
Method Detail

generate

public java.lang.String generate(boolean isMacro)
This method actually generates the String.
Parameters:
isMacro - tells whether or not this is a call from the exportMacro function.
Returns:
a string representing the file to be output.

connection2xml

public org.w3c.dom.Element connection2xml(GraphicGate obj,
                                          GraphicGate input)
Takes two gates and generates an xml connection between them.
Parameters:
obj - the source gate.
input - the destination gate.
Returns:
a dom object representing the connection.

gate2xml

public org.w3c.dom.Element gate2xml(GraphicGate obj)
Takes a gate and returns a dom object representing that gate.
Parameters:
obj - the gate we would like to translate.
Returns:
a DOM element.

macro2xml

public org.w3c.dom.Element macro2xml(Macro macro)
Takes a macro object and returns a DOM element representing the objec.
Parameters:
macro - The macro to convert.
Returns:
a dom element representing the macro.