home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / browser / ns405lyc / nav40.z / jsd10.jar / netscape / jsdebug / ThreadStateBase.class (.txt) < prev   
Encoding:
Java Class File  |  1998-03-24  |  2.5 KB  |  113 lines

  1. package netscape.jsdebug;
  2.  
  3. public abstract class ThreadStateBase {
  4.    protected Thread thread;
  5.    protected boolean valid;
  6.    protected boolean runningHook;
  7.    protected boolean resumeWhenDone;
  8.    protected int status;
  9.    protected int continueState;
  10.    protected StackFrameInfo[] stack;
  11.    protected Object returnValue;
  12.    protected Throwable currentException;
  13.    protected int currentFramePtr;
  14.    protected ThreadStateBase previous;
  15.    public static final int THR_STATUS_UNKNOWN = 1;
  16.    public static final int THR_STATUS_ZOMBIE = 2;
  17.    public static final int THR_STATUS_RUNNING = 3;
  18.    public static final int THR_STATUS_SLEEPING = 4;
  19.    public static final int THR_STATUS_MONWAIT = 5;
  20.    public static final int THR_STATUS_CONDWAIT = 6;
  21.    public static final int THR_STATUS_SUSPENDED = 7;
  22.    public static final int THR_STATUS_BREAK = 8;
  23.    public static final int DEBUG_STATE_DEAD = 1;
  24.    public static final int DEBUG_STATE_RUN = 2;
  25.    public static final int DEBUG_STATE_RETURN = 3;
  26.    public static final int DEBUG_STATE_THROW = 4;
  27.    private static final boolean ASS = true;
  28.  
  29.    public static ThreadStateBase getThreadState(Thread var0) throws InvalidInfoException {
  30.       throw new InternalError("unimplemented");
  31.    }
  32.  
  33.    public Thread getThread() {
  34.       return this.thread;
  35.    }
  36.  
  37.    public boolean isValid() {
  38.       return this.valid;
  39.    }
  40.  
  41.    public boolean isRunningHook() {
  42.       return this.runningHook;
  43.    }
  44.  
  45.    public int getStatus() {
  46.       return this.status;
  47.    }
  48.  
  49.    public abstract int countStackFrames() throws InvalidInfoException;
  50.  
  51.    public abstract StackFrameInfo getCurrentFrame() throws InvalidInfoException;
  52.  
  53.    public synchronized StackFrameInfo[] getStack() throws InvalidInfoException {
  54.       if (this.stack == null) {
  55.          this.stack = new StackFrameInfo[this.countStackFrames()];
  56.       }
  57.  
  58.       if (this.stack.length == 0) {
  59.          return this.stack;
  60.       } else {
  61.          StackFrameInfo var1 = this.getCurrentFrame();
  62.          this.stack[this.stack.length - 1] = var1;
  63.  
  64.          for(int var2 = this.stack.length - 2; var2 >= 0; --var2) {
  65.             var1 = var1.getCaller();
  66.             this.stack[var2] = var1;
  67.          }
  68.  
  69.          return this.stack;
  70.       }
  71.    }
  72.  
  73.    public void leaveSuspended() {
  74.       this.resumeWhenDone = false;
  75.    }
  76.  
  77.    public synchronized void resume() {
  78.       if (this.runningHook) {
  79.          this.resumeWhenDone = true;
  80.       } else {
  81.          this.resume0();
  82.       }
  83.    }
  84.  
  85.    protected abstract void resume0();
  86.  
  87.    public int getContinueState() {
  88.       return this.continueState;
  89.    }
  90.  
  91.    public int setContinueState(int var1) {
  92.       int var2 = this.continueState;
  93.       this.continueState = var1;
  94.       return var2;
  95.    }
  96.  
  97.    public Object getReturnValue() throws IllegalStateException {
  98.       if (this.continueState != 3) {
  99.          throw new IllegalStateException("no value being returned");
  100.       } else {
  101.          return this.returnValue;
  102.       }
  103.    }
  104.  
  105.    public Throwable getException() throws IllegalStateException {
  106.       if (this.continueState != 4) {
  107.          throw new IllegalStateException("no exception throw in progress");
  108.       } else {
  109.          return this.currentException;
  110.       }
  111.    }
  112. }
  113.