public class SymbolicLayoutWriter extends AbstractWriter
ISymbolicLayout
s
as XML file. Such files can be read via a SymbolicLayoutReader
instance.SymbolicLayoutReader
ATTRIBUTE_ENCODING, ATTRIBUTE_XML_ID, DEFAULT_ENCODING, LEADING_WHITE_SPACE_PER_LEVEL, NEW_LINE
Constructor and Description |
---|
SymbolicLayoutWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
appendAssociation(int level,
ISymbolicLayout model,
ISymbolicAssociation association,
StringBuffer sb)
Appends the given
ISymbolicAssociation with its children to the given StringBuffer . |
protected void |
appendEquivalenceClass(int level,
ISymbolicEquivalenceClass ec,
StringBuffer sb)
Appends the given
ISymbolicEquivalenceClass with its children to the given StringBuffer . |
protected void |
appendModel(int level,
ISymbolicLayout model,
StringBuffer sb)
Appends the given
ISymbolicLayout with its children to the given StringBuffer . |
protected void |
appendObject(int level,
ISymbolicLayout model,
ISymbolicObject object,
StringBuffer sb)
Appends the given
ISymbolicObject with its children to the given StringBuffer . |
protected void |
appendState(int level,
ISymbolicLayout model,
ISymbolicState state,
StringBuffer sb)
Appends the given
ISymbolicState with its children to the given StringBuffer . |
protected void |
appendValue(int level,
ISymbolicValue value,
StringBuffer sb)
Appends the given
ISymbolicValue with its children to the given StringBuffer . |
protected String |
computeObjectId(ISymbolicLayout model,
ISymbolicObject object)
Computes a unique ID for the given object in the given model.
|
String |
toXML(ISymbolicLayout model,
String encoding)
Converts the given
ISymbolicLayout into XML. |
void |
write(ISymbolicLayout model,
String encoding,
File file)
Writes the given
ISymbolicLayout as XML file. |
void |
write(ISymbolicLayout model,
String encoding,
OutputStream out)
Writes the given
ISymbolicLayout into the OutputStream . |
appendAttribute, appendEmptyTag, appendEndTag, appendNewLine, appendStartTag, appendWhiteSpace, appendXmlHeader
public static final String TAG_MODEL
ISymbolicLayout
s.public static final String TAG_STATE
ISymbolicState
s.public static final String TAG_OBJECT
ISymbolicObject
s.public static final String TAG_VALUE
ISymbolicValue
s.public static final String TAG_ASSOCIATION
ISymbolicAssociation
s.public static final String TAG_EQUIVALENCE_CLASS
ISymbolicEquivalenceClass
s.public static final String TAG_TERM
ISymbolicEquivalenceClass.getTerms()
s.public static final String ATTRIBUTE_NAME
ISymbolicObject.getNameString()
.public static final String ATTRIBUTE_PROGRAM_VARIABLE
ISymbolicValue.getProgramVariableString()
and ISymbolicAssociation.getProgramVariableString()
.public static final String ATTRIBUTE_VALUE
ISymbolicValue.getValueString()
.public static final String ATTRIBUTE_CONDITION
ISymbolicValue.getConditionString()
and
ISymbolicAssociation.getConditionString()
.public static final String ATTRIBUTE_TARGET
ISymbolicAssociation.getTarget()
.public static final String ATTRIBUTE_TERM
ISymbolicEquivalenceClass.getTermStrings()
public static final String ATTRIBUTE_REPRESENTATIVE
ISymbolicEquivalenceClass.getRepresentativeString()
.public static final String ATTRIBUTE_TYPE
ISymbolicValue.getTypeString()
and
ISymbolicObject.getTypeString()
.public static final String ATTRIBUTE_IS_ARRAY_INDEX
ISymbolicValue.isArrayIndex()
and
ISymbolicAssociation.getArrayIndexString()
.public static final String ATTRIBUTE_ARRAY_INDEX
ISymbolicValue.getArrayIndexString()
and
ISymbolicAssociation.getArrayIndexString()
.public void write(ISymbolicLayout model, String encoding, File file) throws IOException
ISymbolicLayout
as XML file.model
- The ISymbolicLayout
to save.encoding
- The encoding to use.file
- The File
to save to.IOException
- Occurred Exception.public void write(ISymbolicLayout model, String encoding, OutputStream out) throws IOException
ISymbolicLayout
into the OutputStream
.node
- The ISymbolicLayout
to save.encoding
- The encoding to use.out
- The OutputStream
to save to. The OutputStream
will be closed by this method.IOException
- Occurred Exception.public String toXML(ISymbolicLayout model, String encoding)
ISymbolicLayout
into XML.node
- The ISymbolicLayout
to convert.encoding
- The encoding to use.protected void appendModel(int level, ISymbolicLayout model, StringBuffer sb)
ISymbolicLayout
with its children to the given StringBuffer
.level
- The level to use.model
- The ISymbolicLayout
to append.sb
- The StringBuffer
to append to.protected void appendEquivalenceClass(int level, ISymbolicEquivalenceClass ec, StringBuffer sb)
ISymbolicEquivalenceClass
with its children to the given StringBuffer
.level
- The level to use.ec
- The ISymbolicEquivalenceClass
to append.sb
- The StringBuffer
to append to.protected void appendState(int level, ISymbolicLayout model, ISymbolicState state, StringBuffer sb)
ISymbolicState
with its children to the given StringBuffer
.level
- The level to use.model
- The ISymbolicLayout
which provides all objects.state
- The ISymbolicState
to append.sb
- The StringBuffer
to append to.protected void appendObject(int level, ISymbolicLayout model, ISymbolicObject object, StringBuffer sb)
ISymbolicObject
with its children to the given StringBuffer
.level
- The level to use.model
- The ISymbolicLayout
which provides all objects.object
- The ISymbolicObject
to append.sb
- The StringBuffer
to append to.protected void appendValue(int level, ISymbolicValue value, StringBuffer sb)
ISymbolicValue
with its children to the given StringBuffer
.level
- The level to use.value
- The ISymbolicValue
to append.sb
- The StringBuffer
to append to.protected void appendAssociation(int level, ISymbolicLayout model, ISymbolicAssociation association, StringBuffer sb)
ISymbolicAssociation
with its children to the given StringBuffer
.level
- The level to use.model
- The ISymbolicLayout
which provides all objects.association
- The ISymbolicAssociation
to append.sb
- The StringBuffer
to append to.protected String computeObjectId(ISymbolicLayout model, ISymbolicObject object)
model
- The ISymbolicLayout
which provides all objects.object
- The ISymbolicObject
to compute its unique ID.