View Javadoc

1   //
2   // THIS FILE IS AUTOMATICALLY GENERATED!!
3   //
4   // Generated at 2009-08-09 by the VDM++ to JAVA Code Generator
5   // (v8.2.1b - Wed 15-Jul-2009 14:09:22)
6   //
7   // Supported compilers: jdk 1.4/1.5/1.6
8   //
9   
10  // ***** VDMTOOLS START Name=HeaderComment KEEP=NO
11  // ***** VDMTOOLS END Name=HeaderComment
12  
13  // ***** VDMTOOLS START Name=package KEEP=NO
14  package org.overturetool.api.xml;
15  
16  // ***** VDMTOOLS END Name=package
17  
18  // ***** VDMTOOLS START Name=imports KEEP=NO
19  
20  import jp.co.csk.vdm.toolbox.VDM.*;
21  import java.util.*;
22  // ***** VDMTOOLS END Name=imports
23  
24  
25  
26  public class XmlDocument extends XmlEvent {
27  
28  // ***** VDMTOOLS START Name=vdmComp KEEP=NO
29    static UTIL.VDMCompare vdmComp = new UTIL.VDMCompare();
30  // ***** VDMTOOLS END Name=vdmComp
31  
32  // ***** VDMTOOLS START Name=entities KEEP=NO
33    public XmlEntityList entities = null;
34  // ***** VDMTOOLS END Name=entities
35  
36  
37  // ***** VDMTOOLS START Name=vdm_init_XmlDocument KEEP=NO
38    private void vdm_init_XmlDocument () throws CGException {
39      try {
40        entities = (XmlEntityList) new XmlEntityList();
41      }
42      catch (Exception e){
43  
44        e.printStackTrace(System.out);
45        System.out.println(e.getMessage());
46      }
47    }
48  // ***** VDMTOOLS END Name=vdm_init_XmlDocument
49  
50  
51  // ***** VDMTOOLS START Name=XmlDocument KEEP=NO
52    public XmlDocument () throws CGException {
53      vdm_init_XmlDocument();
54    }
55  // ***** VDMTOOLS END Name=XmlDocument
56  
57  
58  // ***** VDMTOOLS START Name=addEntity#1|XmlEntity KEEP=NO
59    public void addEntity (final XmlEntity pent) throws CGException {
60      entities.addTail((XmlEntity) pent);
61    }
62  // ***** VDMTOOLS END Name=addEntity#1|XmlEntity
63  
64  
65  // ***** VDMTOOLS START Name=accept#1|XmlVisitor KEEP=NO
66    public void accept (final XmlVisitor pxv) throws CGException {
67      pxv.VisitXmlDocument((XmlDocument) this);
68    }
69  // ***** VDMTOOLS END Name=accept#1|XmlVisitor
70  
71  
72  // ***** VDMTOOLS START Name=StartDocument KEEP=NO
73    protected Boolean StartDocument () throws CGException {
74      return new Boolean(true);
75    }
76  // ***** VDMTOOLS END Name=StartDocument
77  
78  
79  // ***** VDMTOOLS START Name=StopDocument KEEP=NO
80    protected Boolean StopDocument () throws CGException {
81      return new Boolean(true);
82    }
83  // ***** VDMTOOLS END Name=StopDocument
84  
85  
86  // ***** VDMTOOLS START Name=StartEntity#1|String KEEP=NO
87    protected Boolean StartEntity (final String pname) throws CGException {
88  
89      XmlEntity nxe = new XmlEntity(pname);
90      if ((stackDepth().intValue() == new Long(0).intValue())) {
91  
92        addEntity((XmlEntity) nxe);
93        pushEntity((XmlEntity) nxe);
94      }
95      else {
96  
97        XmlEntity obj_7 = null;
98        obj_7 = (XmlEntity) peekEntity();
99        obj_7.addEntity((XmlEntity) nxe);
100       pushEntity((XmlEntity) nxe);
101     }
102     return new Boolean(true);
103   }
104 // ***** VDMTOOLS END Name=StartEntity#1|String
105 
106 
107 // ***** VDMTOOLS START Name=StopEntity#1|String KEEP=NO
108   protected Boolean StopEntity (final String pname) throws CGException {
109     if (((stackDepth().intValue()) > (new Long(0).intValue()))) {
110 
111       Boolean cond_6 = null;
112       String var1_7 = null;
113       var1_7 = peekEntity().name;
114       cond_6 = new Boolean(UTIL.equals(var1_7, pname));
115       if (cond_6.booleanValue()) {
116 
117         popEntity();
118         return new Boolean(true);
119       }
120       else 
121         return new Boolean(false);
122     }
123     else 
124       return new Boolean(false);
125   }
126 // ***** VDMTOOLS END Name=StopEntity#1|String
127 
128 
129 // ***** VDMTOOLS START Name=StartAttribute#2|String|String KEEP=NO
130   protected Boolean StartAttribute (final String pattr, final String pval) throws CGException {
131     if (((stackDepth().intValue()) > (new Long(0).intValue()))) {
132 
133       XmlEntity obj_8 = null;
134       obj_8 = (XmlEntity) peekEntity();
135       obj_8.addAttribute((XmlAttribute) new XmlAttribute(pattr, pval));
136       return new Boolean(true);
137     }
138     else 
139       return new Boolean(false);
140   }
141 // ***** VDMTOOLS END Name=StartAttribute#2|String|String
142 
143 
144 // ***** VDMTOOLS START Name=StartData#1|String KEEP=NO
145   protected Boolean StartData (final String pdata) throws CGException {
146     if (((stackDepth().intValue()) > (new Long(0).intValue()))) {
147 
148       XmlEntity obj_7 = null;
149       obj_7 = (XmlEntity) peekEntity();
150       obj_7.addData((XmlData) new XmlData(pdata));
151       return new Boolean(true);
152     }
153     else 
154       return new Boolean(false);
155   }
156 // ***** VDMTOOLS END Name=StartData#1|String
157 
158 }
159 ;