|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkorat.gui.viz.ToXMLInstanceConverter
public class ToXMLInstanceConverter
Converts arbitrary object into Alloy4Viz instance (.xml) file and theme
(.thm) file. Those two files should be given to VizGUI
instance in order to visualize its object structure.
Field Summary | |
---|---|
private static String[] |
colors
|
static String |
DEFAULT_MODELS_HOME
|
static String |
DEFAULT_THEMES_HOME
|
private String |
generatedModelFilename
|
private String |
generatedThemeFilename
|
private static String[] |
shapes
|
private boolean |
skipThemeGeneration
|
protected Map<AlloyAtom,Object> |
visited
|
protected Stack<AlloyAtom> |
workList
|
Constructor Summary | |
---|---|
ToXMLInstanceConverter()
|
|
ToXMLInstanceConverter(boolean generateTheme)
|
Method Summary | |
---|---|
private void |
buildModel(Object obj)
|
void |
convert(Object obj)
Performs conversion of the given object. |
void |
convert(Object obj,
int idx)
Performs conversion of the given object. |
void |
convert(Object obj,
PrintStream instanceXMLStream,
PrintStream themeXMLStream)
Performs conversion of the given object. |
void |
convert(Object obj,
String suffix)
Performs conversion of the given object. |
String |
getGeneratedModelFilename()
|
String |
getGeneratedThemeFilename()
|
private void |
handleArrayField(Object obj,
Field f,
AlloySig clzSig,
AlloyAtom atom)
|
private void |
handleClass(Class clz,
AlloyAtom atom)
|
private void |
handleCollectionField(Object obj,
Field f,
AlloySig clzSig,
AlloyAtom atom)
|
private void |
handleFields(Class clz,
AlloyAtom atom)
|
private void |
handlePrimitives(Object obj,
Field f,
AlloySig objSig,
AlloyAtom objAtom)
|
private void |
writeInstanceXML(PrintStream ps,
String filename,
String command)
|
private void |
writeThemeXML(PrintStream ps)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<AlloyAtom,Object> visited
protected Stack<AlloyAtom> workList
public static final String DEFAULT_MODELS_HOME
public static final String DEFAULT_THEMES_HOME
private String generatedThemeFilename
private String generatedModelFilename
private boolean skipThemeGeneration
private static final String[] colors
private static final String[] shapes
Constructor Detail |
---|
public ToXMLInstanceConverter(boolean generateTheme)
public ToXMLInstanceConverter()
Method Detail |
---|
public String getGeneratedModelFilename()
public String getGeneratedThemeFilename()
public void convert(Object obj) throws UnsupportedTypeException
getGeneratedModelFilename
and
getGeneratedThemeFilename
methods.
obj
- object to convert to alloy instance & theme file
UnsupportedTypeException
- currently, the only primitive type that is supported is int.
If any other primitive type is found, the exception will be
thrown.public void convert(Object obj, int idx) throws UnsupportedTypeException
getGeneratedModelFilename
and
getGeneratedThemeFilename
methods.
obj
- object to convert to alloy instance & theme fileidx
- index to append at the end of the instance file name
UnsupportedTypeException
- currently, the only primitive type that is supported is int.
If any other primitive type is found, the exception will be
thrown.public void convert(Object obj, String suffix) throws UnsupportedTypeException
getGeneratedModelFilename
and
getGeneratedThemeFilename
methods.
obj
- object to convert to alloy instance & theme filesuffix
- suffix to append at the end of the instance file name
UnsupportedTypeException
- currently, the only primitive type that is supported is int.
If any other primitive type is found, the exception will be
thrown.public void convert(Object obj, PrintStream instanceXMLStream, PrintStream themeXMLStream) throws UnsupportedTypeException
instanceXMLStream
and themeXMLStream
respectively).
obj
- object to convert to alloy instance & themeinstanceXMLStream
- stream to write the instance file tothemeXMLStream
- stream to write the theme file to
UnsupportedTypeException
- currently, the only primitive type that is supported is int.
If any other primitive type is found, the exception will be
thrown.private void writeThemeXML(PrintStream ps)
private void writeInstanceXML(PrintStream ps, String filename, String command)
private void buildModel(Object obj) throws UnsupportedTypeException
UnsupportedTypeException
private void handleClass(Class clz, AlloyAtom atom) throws UnsupportedTypeException
UnsupportedTypeException
private void handleFields(Class clz, AlloyAtom atom) throws UnsupportedTypeException
UnsupportedTypeException
private void handleArrayField(Object obj, Field f, AlloySig clzSig, AlloyAtom atom) throws IllegalArgumentException, IllegalAccessException
IllegalArgumentException
IllegalAccessException
private void handleCollectionField(Object obj, Field f, AlloySig clzSig, AlloyAtom atom) throws IllegalArgumentException, IllegalAccessException
IllegalArgumentException
IllegalAccessException
private void handlePrimitives(Object obj, Field f, AlloySig objSig, AlloyAtom objAtom) throws UnsupportedTypeException, IllegalAccessException
UnsupportedTypeException
IllegalAccessException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |