2003/11/13 05:04:22
[org.ibex.core.git] / src / org / xwt / js / Internal.java
index cf19716..d23794b 100644 (file)
@@ -10,7 +10,7 @@ class Internal {
     // Package Helper Methods //////////////////////////////////////////////////////////////
 
     private static Object wrapInt(int i) { return new Integer(i); }
-    static Object callMethodOnPrimitive(Object o, Object method, JS.Array args) {
+    static Object callMethodOnPrimitive(Object o, Object method, JSArray args) {
         int alength = args.length();
         String s;
         if(o instanceof Number) {
@@ -74,13 +74,13 @@ class Internal {
             return wrapInt(s.lastIndexOf(search,start));            
         }
         if(method.equals("match")) {
-            return Regexp.stringMatch(s,args);
+            return JSRegexp.stringMatch(s,args);
         }
         if(method.equals("replace")) {
-            return Regexp.stringReplace(s,args);
+            return JSRegexp.stringReplace(s,args);
         }
         if(method.equals("search")) {
-            return Regexp.stringSearch(s,args);
+            return JSRegexp.stringSearch(s,args);
         }
         if(method.equals("slice")) {
             int a = alength >= 1 ? JS.toInt(args.elementAt(0)) : 0;
@@ -95,7 +95,7 @@ class Internal {
             return s.substring(a,b);
         }
         if(method.equals("split")){
-            return Regexp.stringSplit(s,args);
+            return JSRegexp.stringSplit(s,args);
         } 
         if(method.equals("toLowerCase")) return s.toLowerCase();
         if(method.equals("toUpperCase")) return s.toUpperCase();
@@ -104,14 +104,14 @@ class Internal {
     }
     
     static Object getFromPrimitive(Object o, Object key) {
-        boolean returnCallable = false;
+        boolean returnJSCallable = false;
         if(o instanceof Boolean) {
             // no properties for Booleans
         } else if(o instanceof Number) {
             if(key.equals("toPrecision") || key.equals("toExponential") || key.equals("toFixed"))
-                returnCallable = true;
+                returnJSCallable = true;
         }
-        if(!returnCallable) {
+        if(!returnJSCallable) {
             // the string stuff applies to everything
             String s = o.toString();
             
@@ -124,22 +124,22 @@ class Internal {
                 key.equals("seatch") || key.equals("slice") || key.equals("split") || key.equals("toLowerCase") ||
                 key.equals("toUpperCase") || key.equals("toString") || key.equals("substr")
             )
-                returnCallable = true;
+                returnJSCallable = true;
         }
-        if(returnCallable) {
+        if(returnJSCallable) {
             final Object target = o;
             final String method = key.toString();
-            return new JS.Callable() {
-                public Object call(JS.Array args) { return callMethodOnPrimitive(target,method,args); }
+            return new JSCallable() {
+                public Object call(JSArray args) { return callMethodOnPrimitive(target,method,args); }
             };
         }
         return null;
     }
     
-    static class CallableStub extends JS.Callable {
+    static class JSCallableStub extends JSCallable {
         private Object method;
-        private JS.Obj obj;
-        public CallableStub(JS.Obj obj, Object method) { this.obj = obj; this.method = method; }
-        public Object call(JS.Array args) { return obj.callMethod(method,args,false); }
+        private JSObj obj;
+        public JSCallableStub(JSObj obj, Object method) { this.obj = obj; this.method = method; }
+        public Object call(JSArray args) { return ((JSCallable)obj).call(method,args); }
     }
 }