This repository was archived by the owner on Feb 29, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebuggableapp.java
More file actions
Latest commit
70 lines (65 loc) · 1.86 KB
/
Copy pathdebuggableapp.java
File metadata and controls
70 lines (65 loc) · 1.86 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
importjava.io.*;
importjava.util.*;
classVar {
privateObjectobject;
publicVar() {
this.object=null;
}
publicVar(Objecto) {
this.object=o;
}
publicvoidset(Objectobject) { this.object = object; }
publicObjectget() { returnobject; }
}
publicclassdebuggableapp {
publicstaticPrintWriterdebug;
publicstaticHashMap<String,Var> db=newHashMap<String,Var>();
publicstaticvoidsetup() {
try {
debug=newPrintWriter(newBufferedWriter(newFileWriter("programdebug.info")));
}catch(Exceptione) {
e.printStackTrace();
System.out.println("WARNING:Log file cannot be initliazed, redirecting to stdout! This may be a restrcited system!");
debug=newPrintWriter(System.out);
}
debug.println("Setup completed");
}
publicstaticvoidsession() {
debug.println("Session started");
System.out.println("Debug 1.0 Session\nPress enter to stop\nWarning timing this program will be messed up!");
Stringtext=">";
Scannersc=newScanner(System.in);
while(!(text.equals(""))) {
System.out.print(">");
text=sc.nextLine();
if(db.containsKey(text)) {
show(db.get(text));
}
}
}
publicstaticvoidshow(Varx) {
debug.println(x.getClass());
if(x.getClass().getName().contains((CharSequence) "List")) {
System.out.println("WARNING this is a list");
debug.println("WARNING this is a list");
}
System.out.println(x.get());
}
publicstaticvoidadd(Varx,Stringfriendlyname) {
db.put(friendlyname, x);
}
publicstaticvoidset(Varx,Stringfriendlyname) {
db.put(friendlyname, x);
}
publicstaticvoidmain(String[] args) {
setup();
Stringx="test";
Vara=newVar("Testing");
add(a,x);
session();
a.set("sync test");
Vara2=newVar(newArrayList<Integer>());
add(a2,"arr");
session();
}
}