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 int
counter
protected String
init
protected Map<InstanceLine,String>
instances
protected Map<AbstractLocation,String>
locations
protected XMLStreamWriter
writer
-
Constructor Summary
Constructors Constructor Description XMLWriter(OutputStream stream)
ConstructorXMLWriter(Writer writer)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
hasFlag(Element element, String property)
Has the element flagprotected void
indent()
Write text to the outputvoid
visitBranchPoint(BranchPoint branchPoint)
Visitor of the branch point, tag 'branchpoint'void
visitCondition(Condition condition)
Visitor of the condition, tag 'condition'void
visitDocument(Document document)
Visitor of the documentvoid
visitEdge(Edge edge)
Visitor of the edge, tag 'transition'void
visitInstanceLine(InstanceLine instance)
Visitor of the instanceLine, tag 'instance'void
visitLocation(Location location)
Visitor of the locationvoid
visitMessage(Message message)
Visitor of the message, tag 'message'void
visitNail(Nail nail)
Visitor of the nail, tag 'nail'void
visitPrechart(Prechart prechart)
Visitor of the preChart, tag 'prechart'void
visitQueries(QueryList queries)
Visitor of the queries, tag 'queries'void
visitQuery(Query query)
Visitor of the query, tag 'query'void
visitTemplate(AbstractTemplate template)
Visitor of the templatevoid
visitUpdate(Update update)
Visitor of the update, tag 'update'protected void
writeAttributes(Element element)
Write the attributesprotected void
writeFlag(Element element, String property)
Write the flagprotected void
writePropertyAsElement(Element element, String property, boolean optional)
Write property as the xml elementprotected void
writePropertyAsLabel(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 XMLStreamException
Write 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:
visitDocument
in interfaceVisitor
- Overrides:
visitDocument
in classAbstractVisitor
- Parameters:
document
- - The model document- Throws:
Exception
-
visitTemplate
public void visitTemplate(AbstractTemplate template) throws Exception
Visitor of the template- Specified by:
visitTemplate
in interfaceVisitor
- Overrides:
visitTemplate
in classAbstractVisitor
- Parameters:
template
- - The abstract template- Throws:
Exception
-
visitLocation
public void visitLocation(Location location) throws Exception
Visitor of the location- Specified by:
visitLocation
in interfaceVisitor
- Overrides:
visitLocation
in classAbstractVisitor
- Parameters:
location
- - The location- Throws:
Exception
-
visitBranchPoint
public void visitBranchPoint(BranchPoint branchPoint) throws Exception
Visitor of the branch point, tag 'branchpoint'- Specified by:
visitBranchPoint
in interfaceVisitor
- Overrides:
visitBranchPoint
in classAbstractVisitor
- Parameters:
branchPoint
- - The branchPoint- Throws:
Exception
-
visitEdge
public void visitEdge(Edge edge) throws Exception
Visitor of the edge, tag 'transition'- Specified by:
visitEdge
in interfaceVisitor
- Overrides:
visitEdge
in classAbstractVisitor
- Parameters:
edge
- - The edge- Throws:
Exception
-
visitNail
public void visitNail(Nail nail) throws Exception
Visitor of the nail, tag 'nail'- Specified by:
visitNail
in interfaceVisitor
- Overrides:
visitNail
in classAbstractVisitor
- Parameters:
nail
- - The nail- Throws:
Exception
-
visitInstanceLine
public void visitInstanceLine(InstanceLine instance) throws Exception
Visitor of the instanceLine, tag 'instance'- Specified by:
visitInstanceLine
in interfaceVisitor
- Overrides:
visitInstanceLine
in classAbstractVisitor
- Parameters:
instance
- - The instanceLine- Throws:
Exception
-
visitPrechart
public void visitPrechart(Prechart prechart) throws Exception
Visitor of the preChart, tag 'prechart'- Specified by:
visitPrechart
in interfaceVisitor
- Overrides:
visitPrechart
in classAbstractVisitor
- Parameters:
prechart
- - The prechart- Throws:
Exception
-
visitMessage
public void visitMessage(Message message) throws Exception
Visitor of the message, tag 'message'- Specified by:
visitMessage
in interfaceVisitor
- Overrides:
visitMessage
in classAbstractVisitor
- Parameters:
message
- - The message- Throws:
Exception
-
visitCondition
public void visitCondition(Condition condition) throws Exception
Visitor of the condition, tag 'condition'- Specified by:
visitCondition
in interfaceVisitor
- Overrides:
visitCondition
in classAbstractVisitor
- Parameters:
condition
- - The condition- Throws:
Exception
-
visitUpdate
public void visitUpdate(Update update) throws Exception
Visitor of the update, tag 'update'- Specified by:
visitUpdate
in interfaceVisitor
- Overrides:
visitUpdate
in classAbstractVisitor
- Parameters:
update
- - The update- Throws:
Exception
-
visitQueries
public void visitQueries(QueryList queries) throws Exception
Visitor of the queries, tag 'queries'- Specified by:
visitQueries
in interfaceVisitor
- Overrides:
visitQueries
in classAbstractVisitor
- Parameters:
queries
- - The QueryListModel- Throws:
Exception
-
visitQuery
public void visitQuery(Query query) throws Exception
Visitor of the query, tag 'query'- Specified by:
visitQuery
in interfaceVisitor
- Overrides:
visitQuery
in classAbstractVisitor
- Parameters:
query
- - The queryProperty- Throws:
Exception
-
-