Revision: 4678
          http://sourceforge.net/p/vexi/code/4678
Author:   mkpg2
Date:     2014-03-17 18:53:59 +0000 (Mon, 17 Mar 2014)
Log Message:
-----------
Add String.compare() method to constructor.

Modified Paths:
--------------
    branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/JSString.java

Modified: 
branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/JSString.java
===================================================================
--- branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/JSString.java  
2014-03-17 17:53:58 UTC (rev 4677)
+++ branches/vexi3/org.vexi-library.js/src/main/java/org/ibex/js/JSString.java  
2014-03-17 18:53:59 UTC (rev 4678)
@@ -15,6 +15,24 @@
                public JS new_(JS[] args) throws JSExn { 
                        return new 
JSString(args.length>0?JSU.toString(args[0]):"");
                }
+        public JS get(JS keyJS) throws JSExn {
+            String key = JSU.toString(keyJS);
+            if("compare".equals(key)){
+               return METHOD;
+            }
+            return super.get(keyJS);
+        }
+        
+        @Override public JS callMethod(JS this_, JS methodJS, JS[] args) 
throws JSExn {
+               String method = JSU.toString(methodJS);
+               if("compare".equals(method)){
+               String a = JSU.expectArg_string(args, 0); 
+                String b = JSU.expectArg_string(args, 1); 
+                if(a==null || b==null) return null;
+                return JSU.N(a.compareTo(b));
+            }
+               return super.callMethod(this_, methodJS, args);
+        }
        };
        
     final String s;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to