home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptExpressionStack.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  2.0 KB  |  67 lines

  1. import java.io.ByteArrayOutputStream;
  2. import java.io.PrintStream;
  3.  
  4. public class JScriptExpressionStack extends JSbxStack {
  5.    public final JSbxValue PopValue() throws JSbxException {
  6.       return ((JSbxVector)this).GetSize() == 0 ? null : this.GetJSbxValue((JSbxBase)((JSbxStack)this).Pop());
  7.    }
  8.  
  9.    public final JSbxValue PeekValue() throws JSbxException {
  10.       return ((JSbxVector)this).GetSize() == 0 ? null : this.GetJSbxValue((JSbxBase)((JSbxStack)this).Peek());
  11.    }
  12.  
  13.    public final void PushValue(JSbxValue var1) throws JSbxException {
  14.       ((JSbxStack)this).Push(var1);
  15.    }
  16.  
  17.    public final JSbxProperty PopProperty() throws JSbxException {
  18.       return ((JSbxVector)this).GetSize() == 0 ? null : this.GetJSbxProperty((JSbxBase)((JSbxStack)this).Pop());
  19.    }
  20.  
  21.    public final JSbxProperty PeekProperty() throws JSbxException {
  22.       return ((JSbxVector)this).GetSize() == 0 ? null : this.GetJSbxProperty((JSbxBase)((JSbxStack)this).Peek());
  23.    }
  24.  
  25.    public final void PushProperty(JSbxProperty var1) throws JSbxException {
  26.       ((JSbxStack)this).Push(var1);
  27.    }
  28.  
  29.    private final JSbxProperty GetJSbxProperty(JSbxBase var1) throws JSbxException {
  30.       return var1 instanceof JSbxProperty ? (JSbxProperty)var1 : null;
  31.    }
  32.  
  33.    private final JSbxValue GetJSbxValue(JSbxBase var1) throws JSbxException {
  34.       if (var1 instanceof JSbxProperty) {
  35.          JSbxProperty var2 = (JSbxProperty)var1;
  36.          JSbxValue var3 = new JSbxValue();
  37.          var2.Get(var3);
  38.          return var3;
  39.       } else {
  40.          return (JSbxValue)var1;
  41.       }
  42.    }
  43.  
  44.    public final String DEBUG_GetInfoString() {
  45.       if (((JSbxVector)this).GetSize() == 0) {
  46.          return new String("\tEMPTY");
  47.       } else {
  48.          ByteArrayOutputStream var1 = new ByteArrayOutputStream();
  49.          PrintStream var2 = new PrintStream(var1);
  50.          var2.println("\tTOP");
  51.  
  52.          try {
  53.             for(int var3 = ((JSbxVector)this).GetSize() - 1; var3 >= 0; --var3) {
  54.                var2.print(var3 + ".\t");
  55.                JSbxBase var4 = (JSbxBase)((JSbxVector)this).Get(var3);
  56.                if (var4 != null) {
  57.                   var4.Dump(var2, 0, 0);
  58.                }
  59.             }
  60.          } catch (JSbxException var5) {
  61.          }
  62.  
  63.          return var1.toString();
  64.       }
  65.    }
  66. }
  67.