5 class TypeTestFtsNestingGenerator
8 fun clanit
(i
: Int): String
10 var s
= new FlatBuffer
11 s
.append
("{classes.first}[" * i
)
17 redef fun initnit
(res
)
20 res
.add
"new {clanit(i)}"
27 return "a isa {clanit(middle)}"
30 fun clajava
(i
: Int): String
32 var s
= new FlatBuffer
33 s
.append
("{classes.first}<" * i
)
39 redef fun initjava
(res
, interfaces
)
43 if interfaces
then tagc
= "X"
45 res
.add
"new {tagc}{clajava(i)}()"
49 redef fun testjava
(interfaces
)
51 return "a instanceof {classes.first}<?>"
54 redef fun initcsharp
(res
, interfaces
)
57 if interfaces
then tagc
= "X"
59 res
.add
"new {tagc}{clajava(i)}()"
63 redef fun testcsharp
(interfaces
)
65 return "a is {clajava(middle)}"
68 redef fun initscala
(res
, interfaces
)
71 if interfaces
then tagc
= "X"
73 res
.add
"new {tagc}{clanit(i)}()"
77 redef fun testscala
(interfaces
)
79 return "a.isInstanceOf[{clanit(middle)}]"
82 fun clacpp
(i
: Int): String
84 var s
= new FlatBuffer
85 s
.append
("{classes.first}<" * i
)
91 redef fun initcpp
(res
)
94 res
.add
"new {clacpp(i)}()"
100 write
"\t\t\t{clacpp(middle)} *to = dynamic_cast<{clacpp(middle)}*>(a);"
104 fun clae
(i
: Int): String
106 var s
= new FlatBuffer
107 s
.append
("{classes.first}[" * i
)
113 redef fun inite
(res
, se
)
115 for i
in [1..dept
] do
116 res
.add
"create \{{clae(i)}\} a"
122 write
"\t\t\t\t\tto ?= a"
128 write
"\t\t\tto: {clae(middle)}"
132 var g
= new TypeTestFtsNestingGenerator