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

  1. public class JSbxArrayObject extends JSbxObject implements JSbxPropertyInterface {
  2.    private static final String NAME = "array";
  3.    private static final int SBXARRAY_ID_LENGTH = 1;
  4.    private String aArrTypeInfoStrg = "unknown";
  5.  
  6.    public final void SetArrayType(String var1) {
  7.       this.aArrTypeInfoStrg = var1;
  8.    }
  9.  
  10.    public final String GetArrayType() {
  11.       return this.aArrTypeInfoStrg;
  12.    }
  13.  
  14.    public JSbxArrayObject(long var1) {
  15.       super(var1, JScriptManager.GetConstructorObjectForMe("DefaultConstructor"));
  16.  
  17.       try {
  18.          ((JSbxObject)this).Put(new JSbxObjectProperty("length", this, this, 1, true));
  19.       } catch (JSbxException var3) {
  20.       }
  21.    }
  22.  
  23.    public JSbxProperty Get(int var1, boolean var2) {
  24.       JSbxObject var3 = null;
  25.  
  26.       try {
  27.          var3 = this.getElement(var1);
  28.       } catch (UnsatisfiedLinkError var4) {
  29.       }
  30.  
  31.       return var3 == null ? null : new JSbxValueProperty(String.valueOf(var1), this, new JSbxValue(var3));
  32.    }
  33.  
  34.    public void Put(int var1, JSbxProperty var2) {
  35.    }
  36.  
  37.    public JSbxProperty Get(String var1, boolean var2) {
  38.       JSbxProperty var3 = super.Get(var1, false);
  39.  
  40.       try {
  41.          if (var3 == null) {
  42.             JSbxObject var4 = this.getElement_String(var1);
  43.             if (var4 == null) {
  44.                JSbxProperty var5 = null;
  45.                boolean var6 = false;
  46.                int var7 = 0;
  47.  
  48.                try {
  49.                   var7 = Integer.parseInt(var1);
  50.                   var6 = true;
  51.                } catch (NumberFormatException var8) {
  52.                }
  53.  
  54.                if (var6) {
  55.                   var5 = this.Get(var7, false);
  56.                }
  57.  
  58.                if (var5 == null && var2) {
  59.                   var5 = super.Get(var1, var2);
  60.                }
  61.  
  62.                return var5;
  63.             }
  64.  
  65.             return new JSbxValueProperty(var1, this, new JSbxValue(var4));
  66.          }
  67.       } catch (UnsatisfiedLinkError var9) {
  68.       }
  69.  
  70.       return var3;
  71.    }
  72.  
  73.    public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase {
  74.       throw new JSbxException(0, "no such method in array");
  75.    }
  76.  
  77.    public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  78.       int var3 = var1.GetID();
  79.  
  80.       try {
  81.          switch (var3) {
  82.             case 1:
  83.                var2.Put(new JSbxValue((double)this.getLength()));
  84.                return;
  85.             default:
  86.                throw new JSbxException(0, "no such property in SbxArray (ID=" + var3 + ")");
  87.          }
  88.       } catch (UnsatisfiedLinkError var4) {
  89.       }
  90.    }
  91.  
  92.    public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  93.       throw new JSbxException(0, "no such property in array");
  94.    }
  95.  
  96.    public String Property_GetJScript_typeofString(JSbxObjectProperty var1) {
  97.       return "object";
  98.    }
  99.  
  100.    public String GetJScriptString(boolean var1) {
  101.       return "[object " + this.aArrTypeInfoStrg + "]";
  102.    }
  103.  
  104.    protected native int getLength();
  105.  
  106.    protected native JSbxObject getElement(int var1);
  107.  
  108.    protected native JSbxObject getElement_String(String var1);
  109. }
  110.