Revision: 4204
          http://vexi.svn.sourceforge.net/vexi/?rev=4204&view=rev
Author:   clrg
Date:     2011-08-17 02:04:17 +0000 (Wed, 17 Aug 2011)

Log Message:
-----------
Mainly jsdoc work + license fix for JSDecimal.jpp

Modified Paths:
--------------
    trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
    trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/ECMADate.jpp
    trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDate.jpp
    trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp
    trunk/org.vexi-library.js/src/main/jpp/org/vexi/js/VexiJS.jpp

Modified: trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp
===================================================================
--- trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp        
2011-08-17 01:29:35 UTC (rev 4203)
+++ trunk/org.vexi-core.main/src/main/jpp/org/vexi/core/Vexi.jpp        
2011-08-17 02:04:17 UTC (rev 4204)
@@ -1,4 +1,4 @@
-// Copyright 2000-2008 the Contributors, as shown in the revision logs.
+// Copyright 2000-2011 the Contributors, as shown in the revision logs.
 // Licensed under the GNU General Public License version 2 ("the License").
 // You may not use this file except in compliance with the License.
 
@@ -369,7 +369,11 @@
         case "crypto.sha1": return METHOD;
         case "crypto.rc4": return METHOD;
         case "crypto.rsa": return METHOD;
+        
         // FIXME: move to js.legacy
+        /* <p><b>Deprecated</b></p>
+         * <p>Returns an instance of <a 
href="vexi.js.ECMADate.html">vexi.js.ECMADate</a></p>
+         * @return(ECMADate) */
         case "date": return METHOD;
         // FIXME: remove
         /* @skip */

Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/ECMADate.jpp
===================================================================
--- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/ECMADate.jpp     
2011-08-17 01:29:35 UTC (rev 4203)
+++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/ECMADate.jpp     
2011-08-17 02:04:17 UTC (rev 4204)
@@ -42,7 +42,7 @@
  * This class implements the Date native object.
  * See ECMA 15.9.
  * @author Mike McCabe
- * @author Adam Megacz (many modifications
+ * @author Adam Megacz (many modifications)
  */
 public class ECMADate extends JS.Immutable {
 
@@ -123,9 +123,9 @@
 
     public JS get(JS key) throws JSExn {
         //#switch(JSU.toString(key))
-        /*@PAGE(varname=Date,humanname=Date Object) 
+        /*@PAGE(varname=ECMADate,humanname=ECMADate Object) 
          * 
-         * <p>The standard js date object.</p>
+         * <p>The standard ECMA (or JS) date object.</p>
          * */
         /* <p>Returns the day of the month (1-31)</p>
          * @return(Number) */

Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDate.jpp
===================================================================
--- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDate.jpp       
2011-08-17 01:29:35 UTC (rev 4203)
+++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDate.jpp       
2011-08-17 02:04:17 UTC (rev 4204)
@@ -207,10 +207,30 @@
 
     public JS get(JS key) throws JSExn {
         //#switch(JSU.toString(key))
-
+        /*@PAGE(varname=Date,humanname=Date Object) 
+         * 
+         * <p>An alternative to the standard <a 
href="vexi.js.ECMADate.html">vexi.js.ECMADate</a> object
+         * that is a bit saner to work with and intended to be used instead in 
Vexi applications.</p>
+         * 
+         * <p>Whereas the ECMA date object represents a precise instant in 
time (milliseconds),
+         * the Vexi date object represents abstract dates e.g. year/month/day 
... etc.</p>
+         * 
+         * <p>Date parts are optional e.g. can be just year/month.</p>
+         * */
+        
+        /* The year as a standard Gregorian year.
+         * @type(Number) */
         case "year": return getPartJS(PART_YEAR);
+        
+        /* The year as a standard Gregorian month.
+         * @type(Number) */
         case "month": return getPartJS((PART_MONTH));
+        
+        /* The year as a standard Gregorian date.
+         * @type(Number) */
         case "day": return getPartJS((PART_DAY));
+        
+        case "weekday":
         case "hours":
         case "minutes":
         case "seconds":

Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp
===================================================================
--- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp    
2011-08-17 01:29:35 UTC (rev 4203)
+++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp    
2011-08-17 02:04:17 UTC (rev 4204)
@@ -1,89 +1,61 @@
-/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is Rhino code, released
- * May 6, 1999.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation.  Portions created by Netscape are
- * Copyright (C) 1997-1999 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- * Norris Boyd
- * Mike McCabe
- *
- * Alternatively, the contents of this file may be used under the
- * terms of the GNU Public License (the "GPL"), in which case the
- * provisions of the GPL are applicable instead of those above.
- * If you wish to allow use of your version of this file only
- * under the terms of the GPL and not to allow others to use your
- * version of this file under the NPL, indicate your decision by
- * deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL.  If you do not delete
- * the provisions above, a recipient may use your version of this
- * file under either the NPL or the GPL.
- */
+// Copyright 2000-2011 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Software License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
 
 package org.ibex.js;
 
 import java.math.*;
 
 /**
- * This class implements the Date native object.
- * See ECMA 15.9.
- * @author Mike McCabe
- * @author Adam Megacz (many modifications
+ * This class is essentially a wrapper around the Java BigDecimal so that
+ * a similar type can be used in Vexi script.
+ * @author Mike Goodwin
  */
 public class JSDecimal extends JS.Immutable {
 
     static public JS Constructor = new JS.Constructor("Decimal") {
-        private BigDecimal tryParseString(JS arg){
-            try{
+        private BigDecimal tryParseString(JS arg) {
+            try {
                 return new BigDecimal(JSU.toString(arg));
-            }catch(NumberFormatException e){
+            } catch (NumberFormatException e) {
                 return null;
             }
         }
         
         private BigDecimal cast(JS arg) throws JSExn{
-            if(arg instanceof JSDecimal) {
+            if (arg instanceof JSDecimal) {
                 return ((JSDecimal)arg).decimal;
-            }else if(arg instanceof JSNumber){
-                if(JSU.isInt(arg)){
+            } else if (arg instanceof JSNumber) {
+                if (JSU.isInt(arg)) {
                     return new BigDecimal(JSU.toLong(arg));
-                }else{
+                } else {
                     return new BigDecimal(JSU.toDouble(arg));
                 }
             }else{
                 return tryParseString(arg);
             }
         }
-        private BigDecimal cast(JS[] args, int index) throws JSExn{
+        private BigDecimal cast(JS[] args, int index) throws JSExn {
             JS arg = (args.length<=index)?null:args[index];
             BigDecimal r = cast(arg);
-            if(r!=null) return r;
+            if (r!=null) return r;
             throw new JSExn("Expected argument "+index+" to be valid decimal, 
got: "+JSU.toString(arg));
         }
         
         public JS new_(JS[] args) throws JSExn {
             JS argJS = JSU.expectArg(args,0); 
             BigDecimal arg = cast(argJS);
-            if(arg==null) throw new JSExn("Invalid argument: 
"+JSU.toString(argJS));
+            if (arg==null) throw new JSExn("Invalid argument: 
"+JSU.toString(argJS));
             return new JSDecimal(arg);
         }
         
         public JS get(JS key) throws JSExn {
             //#switch(JSU.toString(key))
+            /*@PAGE(varname=Decimal,humanname=Decimal Object)
+             * 
+             * <p>For storing precise numbers of any size.</p>
+             * */
+            
             case "add": return METHOD;
             case "compare": return METHOD;
             case "divide": return METHOD;
@@ -101,33 +73,33 @@
         
         public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
             String methodStr = JSU.toString(method);
-            if(args.length==1){
+            if (args.length==1) {
                 JS arg = args[0];
                 //#switch(methodStr)
                 case "cast":
-                    if(arg instanceof JSDecimal) return arg;
+                    if (arg instanceof JSDecimal) return arg;
                     BigDecimal r = cast(arg);
-                    if(r==null) return null;
+                    if (r==null) return null;
                     return new JSDecimal(r);
                 case "tryParseString":
                     BigDecimal r = tryParseString(args[0]);
-                    if(r==null) return null;
+                    if (r==null) return null;
                     return new JSDecimal(r);
                 //#end
             }
                 
-            if(args.length>=2){
+            if (args.length>=2) {
                 BigDecimal a = cast(args[0]); 
                 BigDecimal b = cast(args[1]); 
-                if(a==null || b==null) return null; 
+                if (a==null || b==null) return null; 
                 
                 //#switch(methodStr)
                 case "add": return new JSDecimal(a.add(b));
                 case "compare": return JSU.N(a.compareTo(b));
                 case "divide": 
-                    try{
+                    try {
                         return new JSDecimal(a.divide(b, a.scale(), 
RoundingMode.HALF_UP));
-                    }catch(java.lang.ArithmeticException e){
+                    } catch (java.lang.ArithmeticException e) {
                         return null;
                     }
                 case "max": return new JSDecimal(a.max(b));
@@ -142,13 +114,13 @@
         
         
     };
-    public boolean instanceOf(JS constructor){ return 
constructor==Constructor; }
-    public void addConstructor(JS constructor) throws JSExn {throw new 
JSExn("Attemted to add constructor to decimal"); }
+    public boolean instanceOf(JS constructor) { return 
constructor==Constructor; }
+    public void addConstructor(JS constructor) throws JSExn { throw new 
JSExn("Attemted to add constructor to decimal"); }
 
     final BigDecimal decimal;
     private JSDecimal(BigDecimal decimal) {
         this.decimal = decimal;
-        if(decimal==null) throw new NullPointerException();
+        if (decimal==null) throw new NullPointerException();
     }
 
     public String coerceToString() { return decimal.toPlainString(); }
@@ -166,7 +138,7 @@
         case "scale": return JSU.N(decimal.scale());
         
         case "number": 
-            if(decimal.stripTrailingZeros().scale()==0){
+            if (decimal.stripTrailingZeros().scale()==0) {
                 return JSU.N(decimal.intValue());
             }
             return JSU.N(decimal.doubleValue());
@@ -180,7 +152,7 @@
     
     
     public JS callMethod(JS this_, JS method, JS[] args) throws JSExn {
-        if(args.length>=1){
+        if (args.length>=1) {
             int n = JSU.toInt(args[0]);
             //#switch(JSU.toString(method))
             case "pow": return new JSDecimal(decimal.pow(n));
@@ -190,17 +162,17 @@
         return super.callMethod(this_, method, args);
     }
     
-    public int hashCode(){ return decimal.hashCode(); }
+    public int hashCode() { return decimal.hashCode(); }
     
     public boolean equals(Object obj) {
-        if(!(obj instanceof JSDecimal)) return false;
+        if (!(obj instanceof JSDecimal)) return false;
         JSDecimal b = (JSDecimal)obj;
         return decimal.equals(b.decimal);
     }
     
     // REMARK may implement JSNumber
     int toInt() { return decimal.intValue(); }
-    long toLong(){ return decimal.longValue(); }
+    long toLong() { return decimal.longValue(); }
     double toDouble() { return decimal.doubleValue(); }
 
 }

Modified: trunk/org.vexi-library.js/src/main/jpp/org/vexi/js/VexiJS.jpp
===================================================================
--- trunk/org.vexi-library.js/src/main/jpp/org/vexi/js/VexiJS.jpp       
2011-08-17 01:29:35 UTC (rev 4203)
+++ trunk/org.vexi-library.js/src/main/jpp/org/vexi/js/VexiJS.jpp       
2011-08-17 02:04:17 UTC (rev 4204)
@@ -1,4 +1,4 @@
-// Copyright 2000-2008 the Contributors, as shown in the revision logs.
+// Copyright 2000-2011 the Contributors, as shown in the revision logs.
 // Licensed under the Apache Software License 2.0 ("the License").
 // You may not use this file except in compliance with the License.
 
@@ -527,6 +527,7 @@
             case "Boolean": return org.ibex.js.JSBoolean.Constructor;
             case "Date": return org.ibex.js.JSDate.Constructor;
             case "Decimal": return org.ibex.js.JSDecimal.Constructor;
+            case "ECMADate": return org.ibex.js.ECMADate.Constructor;
             case "Exception": return org.ibex.js.JSExn.Constructor;
             case "Object": return org.ibex.js.JS.Obj.Constructor;
             case "Number": return org.ibex.js.JSNumber.Constructor;


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

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to