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,
java.lang.StringBuffer sb)
Appends the given
ISymbolicAssociation with its children to the given StringBuffer . |
protected void |
appendEquivalenceClass(int level,
ISymbolicEquivalenceClass ec,
java.lang.StringBuffer sb)
Appends the given
ISymbolicEquivalenceClass with its children to the given StringBuffer . |
protected void |
appendModel(int level,
ISymbolicLayout model,
java.lang.StringBuffer sb)
Appends the given
ISymbolicLayout with its children to the given StringBuffer . |
protected void |
appendObject(int level,
ISymbolicLayout model,
ISymbolicObject object,
java.lang.StringBuffer sb)
Appends the given
ISymbolicObject with its children to the given StringBuffer . |
protected void |
appendState(int level,
ISymbolicLayout model,
ISymbolicState state,
java.lang.StringBuffer sb)
Appends the given
ISymbolicState with its children to the given StringBuffer . |
protected void |
appendValue(int level,
ISymbolicValue value,
java.lang.StringBuffer sb)
Appends the given
ISymbolicValue with its children to the given StringBuffer . |
protected java.lang.String |
computeObjectId(ISymbolicLayout model,
ISymbolicObject object)
Computes a unique ID for the given object in the given model.
|
java.lang.String |
toXML(ISymbolicLayout model,
java.lang.String encoding)
Converts the given
ISymbolicLayout into XML. |
void |
write(ISymbolicLayout model,
java.lang.String encoding,
java.io.File file)
Writes the given
ISymbolicLayout as XML file. |
void |
write(ISymbolicLayout model,
java.lang.String encoding,
java.io.OutputStream out)
Writes the given
ISymbolicLayout into the OutputStream . |
appendAttribute, appendEmptyTag, appendEndTag, appendNewLine, appendStartTag, appendWhiteSpace, appendXmlHeader
public static final java.lang.String TAG_MODEL
ISymbolicLayout
s.public static final java.lang.String TAG_STATE
ISymbolicState
s.public static final java.lang.String TAG_OBJECT
ISymbolicObject
s.public static final java.lang.String TAG_VALUE
ISymbolicValue
s.public static final java.lang.String TAG_ASSOCIATION
ISymbolicAssociation
s.public static final java.lang.String TAG_EQUIVALENCE_CLASS
ISymbolicEquivalenceClass
s.public static final java.lang.String TAG_TERM
ISymbolicEquivalenceClass.getTerms()
s.public static final java.lang.String ATTRIBUTE_NAME
ISymbolicObject.getNameString()
.public static final java.lang.String ATTRIBUTE_PROGRAM_VARIABLE
ISymbolicValue.getProgramVariableString()
and ISymbolicAssociation.getProgramVariableString()
.public static final java.lang.String ATTRIBUTE_VALUE
ISymbolicValue.getValueString()
.public static final java.lang.String ATTRIBUTE_CONDITION
ISymbolicValue.getConditionString()
and
ISymbolicAssociation.getConditionString()
.public static final java.lang.String ATTRIBUTE_TARGET
ISymbolicAssociation.getTarget()
.public static final java.lang.String ATTRIBUTE_TERM
ISymbolicEquivalenceClass.getTermStrings()
public static final java.lang.String ATTRIBUTE_REPRESENTATIVE
ISymbolicEquivalenceClass.getRepresentativeString()
.public static final java.lang.String ATTRIBUTE_TYPE
ISymbolicValue.getTypeString()
and
ISymbolicObject.getTypeString()
.public static final java.lang.String ATTRIBUTE_IS_ARRAY_INDEX
ISymbolicValue.isArrayIndex()
and
ISymbolicAssociation.getArrayIndexString()
.public static final java.lang.String ATTRIBUTE_ARRAY_INDEX
ISymbolicValue.getArrayIndexString()
and
ISymbolicAssociation.getArrayIndexString()
.public void write(ISymbolicLayout model, java.lang.String encoding, java.io.File file) throws java.io.IOException
ISymbolicLayout
as XML file.model
- The ISymbolicLayout
to save.encoding
- The encoding to use.file
- The File
to save to.java.io.IOException
- Occurred Exception.public void write(ISymbolicLayout model, java.lang.String encoding, java.io.OutputStream out) throws java.io.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.java.io.IOException
- Occurred Exception.public java.lang.String toXML(ISymbolicLayout model, java.lang.String encoding)
ISymbolicLayout
into XML.node
- The ISymbolicLayout
to convert.encoding
- The encoding to use.protected void appendModel(int level, ISymbolicLayout model, java.lang.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, java.lang.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, java.lang.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, java.lang.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, java.lang.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, java.lang.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 java.lang.String computeObjectId(ISymbolicLayout model, ISymbolicObject object)
model
- The ISymbolicLayout
which provides all objects.object
- The ISymbolicObject
to compute its unique ID.