|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmapss.dif.language.Writer
public class Writer
Writer class. This class writes all hierarchies to DIF specification. All derived class of DIFGraph or DIFHierarchy can be applied to this Writer. In other words, this Writer class can handle all types of graphs in the DIF package.
The following codes illustrate the usage of Writer:
Writer writer = new Writer(topHierarchy); writer.compile(); writer.write(fileName);
LanguageAnalysis
,
Reader
,
DIFHierarchy
,
DIFGraph
,
DIFWriter
Constructor Summary | |
---|---|
Writer(DIFGraph graph)
Constructs a Writer object from a graph with a runtime type of DIFGraph. |
|
Writer(DIFHierarchy hierarchy)
Constructs a Writer object from a DIFHierarchy object. |
Method Summary | |
---|---|
protected void |
_depthFirstRetrive(DIFHierarchy hierarchy,
java.util.LinkedList levelLinkedList)
This method will perform depth first traverse of hierarchical Hierarchies. |
protected void |
_setDIFWriters()
|
void |
addDIFWriter(java.lang.Class graphClass,
DIFWriter writer)
Add DIFWriter subclass to writers. |
void |
compile()
Compile the DIFHierarchy object associated with this Writer into DIF specification. |
java.util.LinkedList |
retrieveHierarchy(DIFHierarchy hierarchy)
This method will retrieve all hierarchies inside the top level DIFHierarchy and put them into a LinkedList in depth first order. |
java.lang.String |
toString()
Returns the string representation of this Writer object. |
void |
write(java.lang.String fileName)
Write the DIF specification to a DIF file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Writer(DIFGraph graph) throws DIFLanguageException
graph
- A DIFGraph object.
DIFLanguageException
public Writer(DIFHierarchy hierarchy) throws DIFLanguageException
hierarchy
- A DIFHierarchy object.
DIFLanguageException
Method Detail |
---|
public void addDIFWriter(java.lang.Class graphClass, DIFWriter writer)
graphClass
- The Class of the particular graph object.writer
- The DIFWriter subclass object.public void compile() throws DIFLanguageException
DIFLanguageException
public java.util.LinkedList retrieveHierarchy(DIFHierarchy hierarchy)
hierarchy
- A DIFHierarchy object.
public java.lang.String toString()
toString
in class java.lang.Object
public void write(java.lang.String fileName) throws java.io.IOException
fileName
- A file name string. A ".dif" extension will
automatically be appended.
java.io.IOException
- If the file cannot be written.protected void _depthFirstRetrive(DIFHierarchy hierarchy, java.util.LinkedList levelLinkedList)
protected void _setDIFWriters()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |