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 java.lang.Stringinitprotected java.util.Map<InstanceLine,java.lang.String>instancesprotected java.util.Map<AbstractLocation,java.lang.String>locationsprotected javax.xml.stream.XMLStreamWriterwriter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanhasFlag(Element element, java.lang.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, java.lang.String property)Write the flagprotected voidwritePropertyAsElement(Element element, java.lang.String property, boolean optional)Write property as the xml elementprotected voidwritePropertyAsLabel(Element element, java.lang.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 javax.xml.stream.XMLStreamWriter writer
-
locations
protected java.util.Map<AbstractLocation,java.lang.String> locations
-
instances
protected java.util.Map<InstanceLine,java.lang.String> instances
-
init
protected java.lang.String init
-
-
Constructor Detail
-
XMLWriter
public XMLWriter(java.io.OutputStream stream) throws javax.xml.stream.XMLStreamExceptionConstructor- Parameters:
stream- - The output stream- Throws:
javax.xml.stream.XMLStreamException
-
XMLWriter
public XMLWriter(java.io.Writer writer) throws javax.xml.stream.XMLStreamExceptionConstructor- Parameters:
writer- - The java xml writer- Throws:
javax.xml.stream.XMLStreamException
-
-
Method Detail
-
indent
protected void indent() throws javax.xml.stream.XMLStreamExceptionWrite text to the output- Throws:
javax.xml.stream.XMLStreamException
-
writePropertyAsElement
protected void writePropertyAsElement(Element element, java.lang.String property, boolean optional) throws javax.xml.stream.XMLStreamException
Write property as the xml element- Parameters:
element- - The elementproperty- - The propery stringoptional- - The optional value- Throws:
javax.xml.stream.XMLStreamException
-
writePropertyAsLabel
protected void writePropertyAsLabel(Element element, java.lang.String name) throws javax.xml.stream.XMLStreamException
Write the property label, tag 'label' and the attribute 'kind', tag 'kind'- Parameters:
element- - The elementname- - The property name- Throws:
javax.xml.stream.XMLStreamException
-
writeAttributes
protected void writeAttributes(Element element) throws javax.xml.stream.XMLStreamException
Write the attributes- Parameters:
element- - The element- Throws:
javax.xml.stream.XMLStreamException
-
hasFlag
protected boolean hasFlag(Element element, java.lang.String property)
Has the element flag- Parameters:
element- - The elementproperty- - The property- Returns:
- True -It has a flag
-
writeFlag
protected void writeFlag(Element element, java.lang.String property) throws javax.xml.stream.XMLStreamException
Write the flag- Parameters:
element- - The element objectproperty- - The property- Throws:
javax.xml.stream.XMLStreamException
-
visitDocument
public void visitDocument(Document document) throws java.lang.Exception
Visitor of the document- Specified by:
visitDocumentin interfaceVisitor- Overrides:
visitDocumentin classAbstractVisitor- Parameters:
document- - The model document- Throws:
java.lang.Exception
-
visitTemplate
public void visitTemplate(AbstractTemplate template) throws java.lang.Exception
Visitor of the template- Specified by:
visitTemplatein interfaceVisitor- Overrides:
visitTemplatein classAbstractVisitor- Parameters:
template- - The abstract template- Throws:
java.lang.Exception
-
visitLocation
public void visitLocation(Location location) throws java.lang.Exception
Visitor of the location- Specified by:
visitLocationin interfaceVisitor- Overrides:
visitLocationin classAbstractVisitor- Parameters:
location- - The location- Throws:
java.lang.Exception
-
visitBranchPoint
public void visitBranchPoint(BranchPoint branchPoint) throws java.lang.Exception
Visitor of the branch point, tag 'branchpoint'- Specified by:
visitBranchPointin interfaceVisitor- Overrides:
visitBranchPointin classAbstractVisitor- Parameters:
branchPoint- - The branchPoint- Throws:
java.lang.Exception
-
visitEdge
public void visitEdge(Edge edge) throws java.lang.Exception
Visitor of the edge, tag 'transition'- Specified by:
visitEdgein interfaceVisitor- Overrides:
visitEdgein classAbstractVisitor- Parameters:
edge- - The edge- Throws:
java.lang.Exception
-
visitNail
public void visitNail(Nail nail) throws java.lang.Exception
Visitor of the nail, tag 'nail'- Specified by:
visitNailin interfaceVisitor- Overrides:
visitNailin classAbstractVisitor- Parameters:
nail- - The nail- Throws:
java.lang.Exception
-
visitInstanceLine
public void visitInstanceLine(InstanceLine instance) throws java.lang.Exception
Visitor of the instanceLine, tag 'instance'- Specified by:
visitInstanceLinein interfaceVisitor- Overrides:
visitInstanceLinein classAbstractVisitor- Parameters:
instance- - The instanceLine- Throws:
java.lang.Exception
-
visitPrechart
public void visitPrechart(Prechart prechart) throws java.lang.Exception
Visitor of the preChart, tag 'prechart'- Specified by:
visitPrechartin interfaceVisitor- Overrides:
visitPrechartin classAbstractVisitor- Parameters:
prechart- - The prechart- Throws:
java.lang.Exception
-
visitMessage
public void visitMessage(Message message) throws java.lang.Exception
Visitor of the message, tag 'message'- Specified by:
visitMessagein interfaceVisitor- Overrides:
visitMessagein classAbstractVisitor- Parameters:
message- - The message- Throws:
java.lang.Exception
-
visitCondition
public void visitCondition(Condition condition) throws java.lang.Exception
Visitor of the condition, tag 'condition'- Specified by:
visitConditionin interfaceVisitor- Overrides:
visitConditionin classAbstractVisitor- Parameters:
condition- - The condition- Throws:
java.lang.Exception
-
visitUpdate
public void visitUpdate(Update update) throws java.lang.Exception
Visitor of the update, tag 'update'- Specified by:
visitUpdatein interfaceVisitor- Overrides:
visitUpdatein classAbstractVisitor- Parameters:
update- - The update- Throws:
java.lang.Exception
-
visitQueries
public void visitQueries(QueryList queries) throws java.lang.Exception
Visitor of the queries, tag 'queries'- Specified by:
visitQueriesin interfaceVisitor- Overrides:
visitQueriesin classAbstractVisitor- Parameters:
queries- - The QueryListModel- Throws:
java.lang.Exception
-
visitQuery
public void visitQuery(Query query) throws java.lang.Exception
Visitor of the query, tag 'query'- Specified by:
visitQueryin interfaceVisitor- Overrides:
visitQueryin classAbstractVisitor- Parameters:
query- - The queryProperty- Throws:
java.lang.Exception
-
-