Class XMLWriter

  • All Implemented Interfaces:
    Visitor

    public class XMLWriter
    extends AbstractVisitor
    The model xml writer class
    • 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.XMLStreamException
        Constructor
        Parameters:
        stream - - The output stream
        Throws:
        javax.xml.stream.XMLStreamException
      • XMLWriter

        public XMLWriter​(java.io.Writer writer)
                  throws javax.xml.stream.XMLStreamException
        Constructor
        Parameters:
        writer - - The java xml writer
        Throws:
        javax.xml.stream.XMLStreamException
    • Method Detail

      • indent

        protected void indent()
                       throws javax.xml.stream.XMLStreamException
        Write 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 element
        property - - The propery string
        optional - - 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 element
        name - - 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 element
        property - - 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 object
        property - - The property
        Throws:
        javax.xml.stream.XMLStreamException
      • visitDocument

        public void visitDocument​(Document document)
                           throws java.lang.Exception
        Visitor of the document
        Specified by:
        visitDocument in interface Visitor
        Overrides:
        visitDocument in class AbstractVisitor
        Parameters:
        document - - The model document
        Throws:
        java.lang.Exception
      • visitLocation

        public void visitLocation​(Location location)
                           throws java.lang.Exception
        Visitor of the location
        Specified by:
        visitLocation in interface Visitor
        Overrides:
        visitLocation in class AbstractVisitor
        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:
        visitBranchPoint in interface Visitor
        Overrides:
        visitBranchPoint in class AbstractVisitor
        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:
        visitEdge in interface Visitor
        Overrides:
        visitEdge in class AbstractVisitor
        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:
        visitNail in interface Visitor
        Overrides:
        visitNail in class AbstractVisitor
        Parameters:
        nail - - The nail
        Throws:
        java.lang.Exception
      • visitPrechart

        public void visitPrechart​(Prechart prechart)
                           throws java.lang.Exception
        Visitor of the preChart, tag 'prechart'
        Specified by:
        visitPrechart in interface Visitor
        Overrides:
        visitPrechart in class AbstractVisitor
        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:
        visitMessage in interface Visitor
        Overrides:
        visitMessage in class AbstractVisitor
        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:
        visitCondition in interface Visitor
        Overrides:
        visitCondition in class AbstractVisitor
        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:
        visitUpdate in interface Visitor
        Overrides:
        visitUpdate in class AbstractVisitor
        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:
        visitQueries in interface Visitor
        Overrides:
        visitQueries in class AbstractVisitor
        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:
        visitQuery in interface Visitor
        Overrides:
        visitQuery in class AbstractVisitor
        Parameters:
        query - - The queryProperty
        Throws:
        java.lang.Exception