Example
parserImport XOCL;
parserImport Languages::MicroJava;
context Root
@Java
public class Printer {
private int copies;
private String string;
public Test(int copies,String string) {
}
private boolean printCount() {
while(copies > 0) {
this.write(string);
this.copies = this.copies - 1;
}
return true;
}
// Embedded XOCL
with JOCL {
@Operation write(string:String)
format(stdout,"~S~%",Seq{string})
end
}
}
end
A transcript of use:
[1] XMF> Printer(3,"HELLO WORLD!!").printCount();
HELLO WORLD!!
HELLO WORLD!!
HELLO WORLD!!
true
[1] XMF>