mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 04:06:43 -04:00
Fix collectgarbage
Converted String switch case to if statements
This commit is contained in:
parent
739852e811
commit
7331f42b0b
@ -135,36 +135,34 @@ public class BaseLib extends TwoArgFunction implements ResourceFinder {
|
|||||||
public Varargs invoke(Varargs args) {
|
public Varargs invoke(Varargs args) {
|
||||||
String s = args.optjstring(1, "collect");
|
String s = args.optjstring(1, "collect");
|
||||||
int ex = args.optint(2, 0);
|
int ex = args.optint(2, 0);
|
||||||
switch (s) {
|
if ( s.equals("stop") ) {
|
||||||
case "stop":
|
|
||||||
return ZERO; // unsupported
|
return ZERO; // unsupported
|
||||||
case "restart":
|
} else if( s.equals("restart") ) {
|
||||||
return ZERO; // unsupported
|
return ZERO; // unsupported
|
||||||
case "collect":
|
} else if( s.equals("collect") ) {
|
||||||
System.gc();
|
System.gc();
|
||||||
return ZERO;
|
return ZERO;
|
||||||
case "count":
|
} else if( s.equals("count") ) {
|
||||||
Runtime rt = Runtime.getRuntime();
|
Runtime rt = Runtime.getRuntime();
|
||||||
long used = rt.totalMemory() - rt.freeMemory();
|
long used = rt.totalMemory() - rt.freeMemory();
|
||||||
return varargsOf(valueOf(used / 1024.), valueOf(used % 1024));
|
return varargsOf(valueOf(used / 1024.), valueOf(used % 1024));
|
||||||
case "step":
|
} else if( s.equals("step") ) {
|
||||||
System.gc();
|
System.gc();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case "setpause":
|
} else if( s.equals("setpause") ) {
|
||||||
return ZERO; // TODO: Store this, despite no effect?
|
return ZERO; // TODO: Store this, despite no effect?
|
||||||
case "setstepmul":
|
} else if( s.equals("setstepmul") ) {
|
||||||
return ZERO; // TODO: Store this, despite no effect?
|
return ZERO; // TODO: Store this, despite no effect?
|
||||||
case "setmajorinc":
|
} else if( s.equals("setmajorinc") ) {
|
||||||
return ZERO; // TODO: Store this, despite no effect?
|
return ZERO; // TODO: Store this, despite no effect?
|
||||||
case "isrunning":
|
} else if( s.equals("isrunning") ) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case "generational":
|
} else if( s.equals("generational") ) {
|
||||||
return ZERO; // unsupported
|
return ZERO; // unsupported
|
||||||
case "incremental":
|
} else if( s.equals("incremental") ) {
|
||||||
return ZERO; // unsupported
|
return ZERO; // unsupported
|
||||||
default:
|
} else {
|
||||||
this.argerror(1, "invalid option '" + s + "'");
|
this.argerror(1, "invalid option '" + s + "'");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user