Package com.uppaal.model.io2
Class XMLWriter
- java.lang.Object
-
- com.uppaal.model.core2.AbstractVisitor
-
- com.uppaal.model.io2.XMLWriter
-
- All Implemented Interfaces:
Visitor
public class XMLWriter extends AbstractVisitor
The model xml writer class
-
-
Field Summary
Fields Modifier and Type Field Description protected intcounterprotected Stringinitprotected Map<InstanceLine,String>instancesprotected Map<AbstractLocation,String>locationsprotected XMLStreamWriterwriter
-
Constructor Summary
Constructors Constructor Description XMLWriter(OutputStream stream)ConstructorXMLWriter(Writer writer)Constructor
-
Method Summary
Modifier and Type Method Description protected booleanhasFlag(Element element, String property)Has the element flagprotected voidindent()Write text to the outputvoidvisitBranchPoint(BranchPoint branchPoint)Visitor of the branch point, tag 'branchpoint'voidvisitCondition(Condition condition)Visitor of the condition, tag 'condition'voidvisitDocument(Document document)Visitor of the documentvoidvisitEdge(Edge edge)Visitor of the edge, tag 'transition'voidvisitInstanceLine(InstanceLine instance)Visitor of the instanceLine, tag 'instance'voidvisitLocation(Location location)Visitor of the locationvoidvisitMessage(Message message)Visitor of the message, tag 'message'voidvisitNail(Nail nail)Visitor of the nail, tag 'nail'voidvisitPrechart(Prechart prechart)Visitor of the preChart, tag 'prechart'voidvisitQueries(QueryList queries)Visitor of the queries, tag 'queries'voidvisitQuery(Query query)Visitor of the query, tag 'query'voidvisitTemplate(AbstractTemplate template)Visitor of the templatevoidvisitUpdate(Update update)Visitor of the update, tag 'update'protected voidwriteAttributes(Element element)Write the attributesprotected voidwriteFlag(Element element, String property)Write the flagprotected voidwritePropertyAsElement(Element element, String property, boolean optional)Write property as the xml elementprotected voidwritePropertyAsLabel(Element element, String name)Write the property label, tag 'label' and the attribute 'kind', tag 'kind'-
Methods inherited from class com.uppaal.model.core2.AbstractVisitor
visitCut, visitElement, visitNode, visitProperty
-
-
-
-
Field Detail
-
counter
protected int counter
-
writer
protected XMLStreamWriter writer
-
locations
protected Map<AbstractLocation,String> locations
-
instances
protected Map<InstanceLine,String> instances
-
init
protected String init
-
-
Constructor Detail
-
XMLWriter
public XMLWriter(OutputStream stream) throws XMLStreamException
Constructor- Parameters:
stream- - The output stream- Throws:
XMLStreamException
-
XMLWriter
public XMLWriter(Writer writer) throws XMLStreamException
Constructor- Parameters:
writer- - The java xml writer- Throws:
XMLStreamException
-
-
Method Detail
-
indent
protected void indent() throws XMLStreamExceptionWrite text to the output- Throws:
XMLStreamException
-
writePropertyAsElement
protected void writePropertyAsElement(Element element, String property, boolean optional) throws XMLStreamException
Write property as the xml element- Parameters:
element- - The elementproperty- - The propery stringoptional- - The optional value- Throws:
XMLStreamException
-
writePropertyAsLabel
protected void writePropertyAsLabel(Element element, String name) throws XMLStreamException
Write the property label, tag 'label' and the attribute 'kind', tag 'kind'- Parameters:
element- - The elementname- - The property name- Throws:
XMLStreamException
-
writeAttributes
protected void writeAttributes(Element element) throws XMLStreamException
Write the attributes- Parameters:
element- - The element- Throws:
XMLStreamException
-
hasFlag
protected boolean hasFlag(Element element, String property)
Has the element flag- Parameters:
element- - The elementproperty- - The property- Returns:
- True -It has a flag
-
writeFlag
protected void writeFlag(Element element, String property) throws XMLStreamException
Write the flag- Parameters:
element- - The element objectproperty- - The property- Throws:
XMLStreamException
-
visitDocument
public void visitDocument(Document document) throws Exception
Visitor of the document- Specified by:
visitDocumentin interfaceVisitor- Overrides:
visitDocumentin classAbstractVisitor- Parameters:
document- - The model document- Throws:
Exception
-
visitTemplate
public void visitTemplate(AbstractTemplate template) throws Exception
Visitor of the template- Specified by:
visitTemplatein interfaceVisitor- Overrides:
visitTemplatein classAbstractVisitor- Parameters:
template- - The abstract template- Throws:
Exception
-
visitLocation
public void visitLocation(Location location) throws Exception
Visitor of the location- Specified by:
visitLocationin interfaceVisitor- Overrides:
visitLocationin classAbstractVisitor- Parameters:
location- - The location- Throws:
Exception
-
visitBranchPoint
public void visitBranchPoint(BranchPoint branchPoint) throws Exception
Visitor of the branch point, tag 'branchpoint'- Specified by:
visitBranchPointin interfaceVisitor- Overrides:
visitBranchPointin classAbstractVisitor- Parameters:
branchPoint- - The branchPoint- Throws:
Exception
-
visitEdge
public void visitEdge(Edge edge) throws Exception
Visitor of the edge, tag 'transition'- Specified by:
visitEdgein interfaceVisitor- Overrides:
visitEdgein classAbstractVisitor- Parameters:
edge- - The edge- Throws:
Exception
-
visitNail
public void visitNail(Nail nail) throws Exception
Visitor of the nail, tag 'nail'- Specified by:
visitNailin interfaceVisitor- Overrides:
visitNailin classAbstractVisitor- Parameters:
nail- - The nail- Throws:
Exception
-
visitInstanceLine
public void visitInstanceLine(InstanceLine instance) throws Exception
Visitor of the instanceLine, tag 'instance'- Specified by:
visitInstanceLinein interfaceVisitor- Overrides:
visitInstanceLinein classAbstractVisitor- Parameters:
instance- - The instanceLine- Throws:
Exception
-
visitPrechart
public void visitPrechart(Prechart prechart) throws Exception
Visitor of the preChart, tag 'prechart'- Specified by:
visitPrechartin interfaceVisitor- Overrides:
visitPrechartin classAbstractVisitor- Parameters:
prechart- - The prechart- Throws:
Exception
-
visitMessage
public void visitMessage(Message message) throws Exception
Visitor of the message, tag 'message'- Specified by:
visitMessagein interfaceVisitor- Overrides:
visitMessagein classAbstractVisitor- Parameters:
message- - The message- Throws:
Exception
-
visitCondition
public void visitCondition(Condition condition) throws Exception
Visitor of the condition, tag 'condition'- Specified by:
visitConditionin interfaceVisitor- Overrides:
visitConditionin classAbstractVisitor- Parameters:
condition- - The condition- Throws:
Exception
-
visitUpdate
public void visitUpdate(Update update) throws Exception
Visitor of the update, tag 'update'- Specified by:
visitUpdatein interfaceVisitor- Overrides:
visitUpdatein classAbstractVisitor- Parameters:
update- - The update- Throws:
Exception
-
visitQueries
public void visitQueries(QueryList queries) throws Exception
Visitor of the queries, tag 'queries'- Specified by:
visitQueriesin interfaceVisitor- Overrides:
visitQueriesin classAbstractVisitor- Parameters:
queries- - The QueryListModel- Throws:
Exception
-
visitQuery
public void visitQuery(Query query) throws Exception
Visitor of the query, tag 'query'- Specified by:
visitQueryin interfaceVisitor- Overrides:
visitQueryin classAbstractVisitor- Parameters:
query- - The queryProperty- Throws:
Exception
-
-