|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmapss.dif.language.DIFWriter
public class DIFWriter
DIFWriter class. Writer class for graphs / hierarchies of runtime type DIFGraph / DIFHierarchy.
This class compiles a DIFGraph or DIFHierarchy instance to dif specification. It traces down to lowest level hierarchies and all subhierarchies of the given hierarchy are compiled into dif specificaitons.
If a writer with another graph type is needed, this class can be extended
overriding the methods _getEmptyGraph(), _graphType(),
_writeBuiltinAttribute() and _isKeyWord(java.lang.String) in an appropriate way.
Labels of graph elements are obtained using DIFGraph.getName()
method.
The name of graph definition in the dif specificaiton is from
Hierarchy.getName()
not from DIFGraph.getName().
LanguageAnalysis,
Reader,
DIFHierarchy,
DIFGraph,
Writer| Field Summary | |
|---|---|
protected DIFGraph |
_graph
|
protected DIFHierarchy |
_hierarchy
|
| Constructor Summary | |
|---|---|
DIFWriter()
Constructor. |
|
| Method Summary | |
|---|---|
protected java.lang.StringBuffer |
_blank(int num)
Output blank spaces. |
protected void |
_checkLabel(java.lang.String label)
Check to see if the name conflicts with reserved labels or not. |
protected DIFGraph |
_getEmptyGraph()
Returns an empty graph with the runtime type of the graphs that are going to be written by this writer. |
protected java.lang.String |
_getObjectName(java.lang.Object reference)
Get object name. |
protected java.lang.String |
_graphType()
Returns a string containing the graph type keyword to be written into the dif file. |
protected boolean |
_isKeyWord(java.lang.String word)
Checks if a string is a keyword in DIF. |
protected java.lang.String |
_writeActor()
Generate the actor block. |
protected java.lang.String |
_writeBuiltinAttribute()
Generate the built-in attribute block. |
protected java.lang.String |
_writeInterface()
Generate the interface block. |
protected java.lang.String |
_writeParameter()
Generate the parameter block. |
protected java.lang.String |
_writeRefinement()
Generate the refinement block. |
protected java.lang.String |
_writeTopology()
Generate the topology block. |
protected java.lang.String |
_writeUserDefAttribute()
Generate the interface block. |
java.lang.String |
compile(DIFGraph graph)
Compile the single level graph to dif specification. |
java.lang.String |
compile(DIFHierarchy hierarchy)
Compile the single level hierarchy to dif specification. |
DIFGraph |
getSupportedGraph()
Get the empty graph with runtime type supported by this class or the derived classes. |
java.lang.String |
objectToString(java.lang.Object value)
Convert Object value to string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DIFGraph _graph
protected DIFHierarchy _hierarchy
| Constructor Detail |
|---|
public DIFWriter()
| Method Detail |
|---|
public java.lang.String compile(DIFGraph graph)
throws DIFLanguageException
DIFLanguageException - If the runtime type of the graph is
not the _getEmptyGraph() or encounter DIF language error in compiling.
public java.lang.String compile(DIFHierarchy hierarchy)
throws DIFLanguageException
DIFLanguageException - If the runtime type of the graph is
not the _getEmptyGraph() or encounter DIF language error in compiling.public DIFGraph getSupportedGraph()
public java.lang.String objectToString(java.lang.Object value)
value -
protected java.lang.StringBuffer _blank(int num)
num - Number of white spaces.
protected void _checkLabel(java.lang.String label)
throws DIFLanguageException
label - The string need to be checked.
DIFLanguageException - If label is a keyword.protected DIFGraph _getEmptyGraph()
protected java.lang.String _graphType()
protected java.lang.String _getObjectName(java.lang.Object reference)
reference - An object of
Node/Edge/Port/DIFParameter or a LinkedList of above.
protected boolean _isKeyWord(java.lang.String word)
word - A string to be checked.
protected java.lang.String _writeActor()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeBuiltinAttribute()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeInterface()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeParameter()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeRefinement()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeTopology()
throws DIFLanguageException
DIFLanguageException
protected java.lang.String _writeUserDefAttribute()
throws DIFLanguageException
DIFLanguageException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||