5 class TypeTestCovarGenerator
11 res
.add
"new {classes.first}[{c}[Root]]"
18 return "a isa {classes.first}[{classes[middle]}[Root]]"
21 redef fun initjava
(res
, interfaces
)
25 if interfaces
then tagc
= "X"
27 res
.add
"new {tagc}{classes.first}<{c}<Root>>()"
31 redef fun testjava
(interfaces
)
33 return "a instanceof {classes.first}"
36 redef fun initcsharp
(res
, interfaces
)
39 if interfaces
then tagc
= "X"
41 res
.add
"new {tagc}{classes.first}<{c}<Root>>()"
45 redef fun testcsharp
(interfaces
)
47 return "a is {classes.first}<{classes[middle]}<Root>>"
50 redef fun initscala
(res
, interfaces
)
53 if interfaces
then tagc
= "X"
55 res
.add
"new {tagc}{classes.first}[{c}[Root]]()"
59 redef fun testscala
(interfaces
)
61 return "a.isInstanceOf[{classes.first}[{classes[middle]}[Root]]]"
64 redef fun initcpp
(res
)
67 res
.add
"new {classes.first}<{c}<Root>*>()"
73 write
"\t\t\t{classes.first}<{classes[middle]}<Root>*> *to = dynamic_cast<{classes.first}<{classes[middle]}<Root>*>*>(a);"
77 redef fun inite
(res
, se
)
80 res
.add
"create \{{classes.first}[{c}[ROOT]]\} a"
86 write
"\t\t\t\t\tto ?= a"
92 write
"\t\t\tto: {classes.first}[{classes[middle]}[ROOT]]"
96 var g
= new TypeTestCovarGenerator