1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 package com.unitesk.atp.treedl;
33
34 import java.util.Iterator;
35
36 import com.unitesk.atp.treedl.TDL.*;
37 import com.unitesk.atp.tool.PluginClass;
38
39 /***
40 * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
41 * @version $Id: JavaEmptyVisitorGenerator.java,v 1.20 2005/11/20 20:20:13 all-x Exp $
42 */
43 public class JavaEmptyVisitorGenerator
44 extends JavaTextGenerator
45 implements TDL_Visitor
46 {
47 /***
48 * {@inheritDoc}
49 */
50 public String getVersion()
51 {
52 return PluginClass.getRevision( "$Revision: 1.20 $" ) + "-stable";
53 }
54
55 public void visitModule( Module node )
56 {
57 generateHeader();
58
59 int indexOfLastDot = getOutClassName().lastIndexOf( '.' );
60 if( indexOfLastDot != -1 )
61 {
62 txt( "package " + getOutClassName().substring( 0, indexOfLastDot ) + ";" ); nl();
63 nl();
64 }
65 String outShortClassName = getOutClassName().substring( indexOfLastDot + 1 );
66
67 txt( "public class " + outShortClassName + " implements ${name}.${visitorName}" ); nl();
68 block_nl();
69 txt( "protected void visit( ${.Node} node ) {}" ); nl();
70 TDL_ModuleMap moduleMap = node.getModuleMap();
71 Iterator it = moduleMap.getModuleNames().iterator();
72 while( it.hasNext() )
73 {
74 TDL_Module tdlModule = moduleMap.getModule( (QID)it.next() );
75 Module t = tdlModule.getRoot();
76 pushNode( t );
77 list
78 ( "i"
79 , 0
80 , t.sizeOptMemberList()
81 , "${optMemberList[i]}"
82 , null
83 ); nl();
84 popNode();
85 }
86 unblock_nl();
87 }
88
89 public void visitNodeTypeDecl( NodeTypeDecl node )
90 {
91 if( node.isAbstract() ) return;
92
93 nl();
94 txt( "public void visit${name}( ${parent.name}.${name} node )" ); nl();
95 block_nl();
96 txt( "visit( node );" ); nl();
97 unblock_nl();
98 }
99
100 public void visitConstTypeDecl( ConstTypeDecl node )
101 {
102 }
103
104 public void visitOperationDecl( OperationDecl node )
105 {
106 }
107
108 public void visitBaseModule( BaseModule node )
109 {
110 throw new UnsupportedOperationException();
111 }
112
113 public void visitConstructorCodeMember( ConstructorCodeMember node )
114 {
115 throw new UnsupportedOperationException();
116 }
117
118 public void visitBodyCodeMember( BodyCodeMember node )
119 {
120 throw new UnsupportedOperationException();
121 }
122
123 public void visitField( Field node )
124 {
125 throw new UnsupportedOperationException();
126 }
127
128 public void visitNonVirtualParameterDecl( NonVirtualParameterDecl node )
129 {
130 throw new UnsupportedOperationException();
131 }
132
133 public void visitVirtualParameterDecl( VirtualParameterDecl node )
134 {
135 throw new UnsupportedOperationException();
136 }
137
138 public void visitCase( Case node )
139 {
140 throw new UnsupportedOperationException();
141 }
142
143 public void visitCaseSignature( CaseSignature node )
144 {
145 throw new UnsupportedOperationException();
146 }
147
148 public void visitParameter( Parameter node )
149 {
150 throw new UnsupportedOperationException();
151 }
152 }