-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComandoWrite.java
More file actions
30 lines (26 loc) · 794 Bytes
/
ComandoWrite.java
File metadata and controls
30 lines (26 loc) · 794 Bytes
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
public class ComandoWrite extends Comando{
public static final int TYPE_TEXT = 1;
public static final int TYPE_ID = 2;
private String content;
private int type;
public void setContent(String content){
this.content = content;
}
public void setType(int type){
this.type = type;
}
public void run(){
if (type == TYPE_ID)
System.out.println(Programa.getVarValue(content)); else
System.out.println(content);
}
public String writeCode(){
return "<write>\n" +
"<type>"+type+"</type>\n"+
"<content>"+content+"</content>\n"+
"</write>\n" ;
}
public String writeJava(){
return "System.out.println("+content+");\n";
}
}