FileDocCategorySizeDatePackage
CallVerificationStack.javaAPI DocAndroid 1.5 API8801Wed May 06 22:41:06 BST 2009tests.util

CallVerificationStack

public class CallVerificationStack extends Stack
A stack to store the parameters of a call, as well as the call stack.

Fields Summary
private static final long
serialVersionUID
private static final CallVerificationStack
_instance
private final Stack
callStack
Constructors Summary
private CallVerificationStack()
Can't be instantiated.


    /*
     * -------------------------------------------------------------------
     * Constructors
     * -------------------------------------------------------------------
     */

            
      
        // empty
    
Methods Summary
public voidclear()
Clear the parameter stack and the call stack.

        this.callStack.clear();
        super.clear();
    
public java.lang.StringgetCurrentSourceClass()
Gets the "current" calling class name.

return
the "current" calling class name

        return this.callStack.peek().getClassName();
    
public java.lang.StringgetCurrentSourceMethod()
Gets the "current" calling method name.

return
the "current" calling method name

        return this.callStack.peek().getMethodName();
    
public static tests.util.CallVerificationStackgetInstance()
Gets the singleton instance.

return
the singleton instance

        return _instance;
    
public java.lang.Objectpop()
Pop an object.

return
the object

        this.callStack.pop();
        return super.pop();
    
public booleanpopBoolean()
Pop a boolean.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Boolean value = (Boolean) wrapper.getValue();
        return value.booleanValue();
    
public charpopChar()
Pop a char.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Character value = (Character) wrapper.getValue();
        return value.charValue();
    
public doublepopDouble()
Pop a double.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Double value = (Double) wrapper.getValue();
        return value.doubleValue();
    
public floatpopFloat()
Pop a float.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Float value = (Float) wrapper.getValue();
        return value.floatValue();
    
public intpopInt()
Pop a int.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Integer value = (Integer) wrapper.getValue();
        return value.intValue();
    
public longpopLong()
Pop a long.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Long value = (Long) wrapper.getValue();
        return value.longValue();
    
public shortpopShort()
Pop a short.

return
the value

        BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop();
        Short value = (Short) wrapper.getValue();
        return value.shortValue();
    
public voidpush(double val)
Pushes a double onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public voidpush(float val)
Pushes a float onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public voidpush(int val)
Pushes an int onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public voidpush(long val)
Pushes a long onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public voidpush(short val)
Pushes a short onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public java.lang.Objectpush(java.lang.Object o)

        pushCallStack();
        return super.push(o);
    
public voidpush(boolean val)
Pushes a boolean onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
public voidpush(char val)
Pushes a char onto the top of this stack.

param
val the value to push

        this.push(new BaseTypeWrapper(val));
    
private voidpushCallStack()
Pushes the call stack.

        StackTraceElement[] eles = (new Throwable()).getStackTrace();
        int i;
        for (i = 1; i < eles.length; i++) {
            if (!eles[i].getClassName().equals(this.getClass().getName())) {
                break;
            }
        }
        this.callStack.push(eles[i]);