package bluej.runtime;
| Interface implemented by all "shell" classes.
|*
* The src for each "shell" class is constructed automatically,
* compiled and executed. They are used for method invocation
* and object creation.
*
* @author Michael Cahill
* @author Michael Kolling
*/
public abstract class Shell{
|
|/**
| A dummy method called by class loader to prepare the class
| after loading.
|
public static void prepare()
{
}
| Provide the shell class with static access to the object
| bench scopes.
|
protected static BJMap getScope(String scopeId)
{
return ExecServer.getScope(scopeId);
}
| Put an object into the scope of one of the object benches.
|
protected static void putObject(String scopeId, String instanceName, Object value)
{
ExecServer.addObject(scopeId, instanceName, value);
}
| Construct an object that allows the result to be plucked out by
| the debugger. We do this so that primitive types can be encapsulated
| properly; if we boxed them, the debugger wouldn't know if the result
| was really primitive or not.
|
public static Object makeObj(final Object o)
{
return new Object() {
@SuppressWarnings("unused")
public Object result = o;
};
}
protected static Object makeObj(final String s)
{
return new Object() {
@SuppressWarnings("unused")
public String result = s;
};
}
protected static Object makeObj(final boolean b)
{
return new Object() {
@SuppressWarnings("unused")
public boolean result = b;
};
}
protected static Object makeObj(final byte b)
{
return new Object() {
@SuppressWarnings("unused")
public byte result = b;
};
}
protected static Object makeObj(final char c)
{
return new Object() {
@SuppressWarnings("unused")
public char result = c;
};
}
protected static Object makeObj(final double d)
{
return new Object() {
@SuppressWarnings("unused")
public double result = d;
};
}
protected static Object makeObj(final float f)
{
return new Object() {
@SuppressWarnings("unused")
public float result = f;
};
}
protected static Object makeObj(final int i)
{
return new Object() {
@SuppressWarnings("unused")
public int result = i;
};
}
protected static Object makeObj(final long l)
{
return new Object() {
@SuppressWarnings("unused")
public long result = l;
};
}
protected static Object makeObj(final short s)
{
return new Object() {
@SuppressWarnings("unused")
public short result = s;
};
}
}
. prepare
. getScope
. putObject
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
. makeObj
125 neLoCode
+ 11 LoComm