home *** CD-ROM | disk | FTP | other *** search
Wrap
public class JScriptStringObject extends JSbxObject implements JSbxPropertyInterface { public static final String NAME = "String"; private String aStr = ""; private static final int STRING_ID_ANCHOR = 1; private static final int STRING_ID_BIG = 2; private static final int STRING_ID_BLINK = 3; private static final int STRING_ID_BOLD = 4; private static final int STRING_ID_CHARAT = 5; private static final int STRING_ID_FIXED = 6; private static final int STRING_ID_FONTCOLOR = 7; private static final int STRING_ID_FONTSIZE = 8; private static final int STRING_ID_INDEXOF = 9; private static final int STRING_ID_ITALICS = 10; private static final int STRING_ID_LASTINDEXOF = 11; private static final int STRING_ID_LINK = 12; private static final int STRING_ID_SMALL = 13; private static final int STRING_ID_STRIKE = 14; private static final int STRING_ID_SUB = 15; private static final int STRING_ID_SUBSTRING = 16; private static final int STRING_ID_SUP = 17; private static final int STRING_ID_TOLOWERCASE = 18; private static final int STRING_ID_TOUPPERCASE = 19; private static final int STRING_ID_LENGTH = 20; private static final int STRING_ID_SPLIT = 21; private static final int STRING_ID_COMPARETO = 22; public void SetString(String var1) { this.aStr = var1; } public String GetString() { return this.aStr; } public JScriptStringObject(JScriptConstructor var1) { super(var1); try { ((JSbxObject)this).Put(new JSbxObjectProperty("anchor", this, this, 1)); ((JSbxObject)this).Put(new JSbxObjectProperty("big", this, this, 2)); ((JSbxObject)this).Put(new JSbxObjectProperty("blink", this, this, 3)); ((JSbxObject)this).Put(new JSbxObjectProperty("bold", this, this, 4)); ((JSbxObject)this).Put(new JSbxObjectProperty("charAt", this, this, 5)); ((JSbxObject)this).Put(new JSbxObjectProperty("fixed", this, this, 6)); ((JSbxObject)this).Put(new JSbxObjectProperty("fontcolor", this, this, 7)); ((JSbxObject)this).Put(new JSbxObjectProperty("fontsize", this, this, 8)); ((JSbxObject)this).Put(new JSbxObjectProperty("indexOf", this, this, 9)); ((JSbxObject)this).Put(new JSbxObjectProperty("italics", this, this, 10)); ((JSbxObject)this).Put(new JSbxObjectProperty("lastIndexOf", this, this, 11)); ((JSbxObject)this).Put(new JSbxObjectProperty("link", this, this, 12)); ((JSbxObject)this).Put(new JSbxObjectProperty("small", this, this, 13)); ((JSbxObject)this).Put(new JSbxObjectProperty("strike", this, this, 14)); ((JSbxObject)this).Put(new JSbxObjectProperty("sub", this, this, 15)); ((JSbxObject)this).Put(new JSbxObjectProperty("substring", this, this, 16)); ((JSbxObject)this).Put(new JSbxObjectProperty("sup", this, this, 17)); ((JSbxObject)this).Put(new JSbxObjectProperty("toLowerCase", this, this, 18)); ((JSbxObject)this).Put(new JSbxObjectProperty("toUpperCase", this, this, 19)); ((JSbxObject)this).Put(new JSbxObjectProperty("length", this, this, 20)); ((JSbxObject)this).Put(new JSbxObjectProperty("split", this, this, 21)); ((JSbxObject)this).Put(new JSbxObjectProperty("compareTo", this, this, 22)); } catch (JSbxException var2) { } } public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase { JSbxVector var3 = var2.GetParamVector(); int var4 = var3 != null ? var3.GetSize() : 0; int var5 = var1.GetID(); JSbxValue var6 = null; String var7 = ""; double var8 = (double)0.0F; boolean var10 = false; boolean var11 = false; switch (var5) { case 1: var7 = "<A NAME=\"" + JScriptWindowObject.GetStringParam(var3, 0) + "\">" + this.aStr + "</A>"; break; case 2: var7 = "<BIG>" + this.aStr + "</BIG>"; break; case 3: var7 = "<BLINK>" + this.aStr + "</BLINK>"; break; case 4: var7 = "<B>" + this.aStr + "</B>"; break; case 5: try { int var21 = (int)JScriptWindowObject.GetDoubleParam(var3, 0); var7 = this.aStr.substring(var21, var21 + 1); } catch (StringIndexOutOfBoundsException var19) { } break; case 6: var7 = "<TT>" + this.aStr + "</TT>"; break; case 7: var7 = "<FONT COLOR=\"" + JScriptWindowObject.GetStringParam(var3, 0) + "\">" + this.aStr + "</FONT>"; break; case 8: var7 = "<FONT SIZE=\"" + JScriptWindowObject.GetStringParam(var3, 0) + "\">" + this.aStr + "</FONT>"; break; case 9: if (var4 > 1) { var8 = (double)this.aStr.indexOf(JScriptWindowObject.GetStringParam(var3, 0), (int)JScriptWindowObject.GetDoubleParam(var3, 1)); } else { var8 = (double)this.aStr.indexOf(JScriptWindowObject.GetStringParam(var3, 0)); } var10 = true; break; case 10: var7 = "<I>" + this.aStr + "</I>"; break; case 11: if (var4 > 1) { var8 = (double)this.aStr.lastIndexOf(JScriptWindowObject.GetStringParam(var3, 0), (int)JScriptWindowObject.GetDoubleParam(var3, 1)); } else { var8 = (double)this.aStr.lastIndexOf(JScriptWindowObject.GetStringParam(var3, 0)); } var10 = true; break; case 12: var7 = "<A HREF=\"" + JScriptWindowObject.GetStringParam(var3, 0) + "\">" + this.aStr + "</A>"; break; case 13: var7 = "<SMALL>" + this.aStr + "</SMALL>"; break; case 14: var7 = "<STRIKE>" + this.aStr + "</STRIKE>"; break; case 15: var7 = "<SUB>" + this.aStr + "</SUB>"; break; case 16: int var12 = (int)JScriptWindowObject.GetDoubleParam(var3, 0); var12 = JScriptTools.CheckStringIndex(this.aStr, var12); if (var4 > 1) { int var22 = (int)JScriptWindowObject.GetDoubleParam(var3, 1); var22 = JScriptTools.CheckStringIndex(this.aStr, var22); var7 = this.aStr.substring(var12, var22); } else { var7 = this.aStr.substring(var12); } break; case 17: var7 = "<SUP>" + this.aStr + "</SUP>"; break; case 18: var7 = this.aStr.toLowerCase(); break; case 19: var7 = this.aStr.toUpperCase(); case 20: default: break; case 21: String var13 = JScriptWindowObject.GetStringParam(var3, 0); JScriptArrayObject var14 = (JScriptArrayObject)JScriptManager.CreateClassObject("Array"); int var15 = 0; int var16 = 0; int var17; for(var17 = 0; (var16 = this.aStr.indexOf(var13, var17)) >= 0; ++var15) { JSbxValueProperty var18 = new JSbxValueProperty(String.valueOf(var15), (JSbxObject)null, new JSbxValue(this.aStr.substring(var17, var16))); ((JSbxObject)var14).Put(var15, var18); var17 = var16 + var13.length(); } JSbxValueProperty var25 = new JSbxValueProperty(String.valueOf(var15), (JSbxObject)null, new JSbxValue(this.aStr.substring(var17, this.aStr.length()))); ((JSbxObject)var14).Put(var15, var25); var6 = new JSbxValue(var14); var11 = true; break; case 22: if (var4 > 0) { var8 = (double)this.aStr.compareTo(JScriptWindowObject.GetStringParam(var3, 0)); } else { var8 = (double)this.aStr.compareTo(""); } var10 = true; } if (!var11) { if (var10) { var6 = new JSbxValue(var8); } else { var6 = new JSbxValue(var7); } } var2.GetRuntimeParam().SetReturnValue(var6); return var6; } public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException { int var3 = var1.GetID(); double var4 = (double)0.0F; switch (var3) { case 20: var4 = (double)this.aStr.length(); default: var2.Put(new JSbxValue(var4)); } } public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException { } public String Property_GetJScript_typeofString(JSbxObjectProperty var1) { return "stringobject"; } public String GetJScriptString(boolean var1) { return this.aStr; } }