jspro-cvs Mailing List for jsPro (Page 2)
Brought to you by:
wigleys
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(51) |
Oct
(21) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(4) |
Feb
(15) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <wi...@us...> - 2003-10-13 15:32:10
|
Update of /cvsroot/jspro/jsPro/docs In directory sc8-pr-cvs1:/tmp/cvs-serv2477 Removed Files: validator.html test.js string.html math.html date.html array.html Log Message: moved the test pages from the docs directory to this directory --- validator.html DELETED --- --- test.js DELETED --- --- string.html DELETED --- --- math.html DELETED --- --- date.html DELETED --- --- array.html DELETED --- |
|
From: <wi...@us...> - 2003-10-13 15:31:50
|
Update of /cvsroot/jspro/jsPro/tests In directory sc8-pr-cvs1:/tmp/cvs-serv2381 Added Files: validator.html test.js string.html math.html date.html array.html Log Message: moved the test pages from the docs directory to this directory --- NEW FILE: validator.html --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- * +-------------------------------------------------------------------------+ * | jsPro - Validator Test Page | * +-------------------------------------------------------------------------+ * | Copyright (C) 2001-2003 Stuart Wigley | * +-------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by| * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | * | General Public License for more details. | * | | * | You should have received a copy of the GNU Lesser General Public License| * | along with this library; if not, write to the Free Software Foundation, | * | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * +-------------------------------------------------------------------------+ * | Authors: Stuart Wigley <stu...@ya...> | * +-------------------------------------------------------------------------+ * $Id: validator.html,v 1.1 2003/10/13 15:31:42 wigleys Exp $ --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>jsPro - Validator</title> <script type="text/javascript" src="../error.js"></script> <script type="text/javascript" src="../debug/debug.js"></script> <script type="text/javascript" src="../validator.js"></script> <script type="text/javascript" src="test.js"></script> <script type="text/javascript"> var oTest = new Test(); var oDebug = new Debug(); var oValidator = new Validator(); </script> </head> <body> <table> <tbody> <tr> <td>Validator.isBlankString()</td> <td><input id="isBlankString1" name="input" type="text" size="5" /></td> <td><input id="isBlankString" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oValidator')" /></td> <td><input id="isBlankStringResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Validator.isDigit()</td> <td><input id="isDigit1" name="input" type="text" size="5" /></td> <td><input id="isDigit" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oValidator')" /></td> <td><input id="isDigitResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Validator.isInteger()</td> <td><input id="isInteger1" name="input" type="text" size="5" /></td> <td><input id="isInteger" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oValidator')" /></td> <td><input id="isIntegerResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> </tbody> </table> </body> </html> --- NEW FILE: test.js --- /** * +-------------------------------------------------------------------------+ * | jsPro - Test | * +-------------------------------------------------------------------------+ * | Copyright (C) 2001-2003 Stuart Wigley | * +-------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by| * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | * | General Public License for more details. | * | | * | You should have received a copy of the GNU Lesser General Public License| * | along with this library; if not, write to the Free Software Foundation, | * | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * +-------------------------------------------------------------------------+ * | Authors: Stuart Wigley <stu...@ya...> | * | Randolph Fielding <gat...@ci...> | * +-------------------------------------------------------------------------+ * $Id: test.js,v 1.1 2003/10/13 15:31:42 wigleys Exp $ */ /** * Creates an object that provides methods for testing all jsPro libraries. * * @author Stuart Wigley * @version 1.0, 07/24/03 * @interface <code>new Test()</code> */ function Test() { } /** * Evaluates and returns the result of a jsPro method using assumptions about * the structure and ids of HTML elements in the jsPro HTML test files. * * @author Stuart Wigley * @author Randolph Fielding * @version 1.1, 08/20/03 * @interface <code>Test.evaluateMethod(oButton, sClass)</code> * @param oButton the HTML input-button element that is clicked * @param sClass the name of the jsPro class instance being tested * @return the result of attempting to evaluate a jsPro method * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException * @throws TypeMismatchException */ Test.prototype.evaluateMethod = function(oButton, sClass) { try { var vError = null; var iNumArguments = arguments.length; if (iNumArguments != 2) { throw vError = new IllegalArgumentException('Error.evaluateMethod', 2, iNumArguments); } if (typeof oButton != 'object') { throw vError = new TypeMismatchException('Error.evaluateMethod', 'object', typeof oButton); } if (typeof sClass != 'string') { throw vError = new TypeMismatchException('Error.evaluateMethod', 'string', typeof sClass); } var sMethodName = oButton.id; var oInput1 = document.getElementById(sMethodName + '1'); var oInput2 = document.getElementById(sMethodName + '2'); var oInput3 = document.getElementById(sMethodName + '3'); var oOutput = document.getElementById(sMethodName + 'Result'); var sArguments = ''; if (oInput1) { var sInput1Value = oInput1.value; if (sInput1Value != '') { var fInput1Value = parseFloat(sInput1Value); sArguments += (isNaN(fInput1Value)) ? '\'' + sInput1Value + '\'' : fInput1Value; } } if (oInput2) { var sInput2Value = oInput2.value; if (sInput2Value != '') { var fInput2Value = parseFloat(sInput2Value); sArguments += (isNaN(fInput2Value)) ? ', \'' + sInput2Value + '\'' : ', ' + fInput2Value; } } if (oInput3) { var sInput3Value = oInput3.value; if (sInput3Value != '') { var fInput3Value = parseFloat(sInput3Value); sArguments += (isNaN(fInput3Value)) ? ', \'' + sInput3Value + '\'' : ', ' + fInput3Value; } } var vResult = eval(sClass + '.' + sMethodName + '(' + sArguments + ')'); } catch (vError) { if (vError instanceof Error) { vError.handleError(); } } finally { if (oOutput) { oOutput.value = vResult; } } } --- NEW FILE: string.html --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- * +-------------------------------------------------------------------------+ * | jsPro - String Test Page | * +-------------------------------------------------------------------------+ * | Copyright (C) 2001-2003 Stuart Wigley | * +-------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by| * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | * | General Public License for more details. | * | | * | You should have received a copy of the GNU Lesser General Public License| * | along with this library; if not, write to the Free Software Foundation, | * | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * +-------------------------------------------------------------------------+ * | Authors: Stuart Wigley <stu...@ya...> | * +-------------------------------------------------------------------------+ * $Id: string.html,v 1.1 2003/10/13 15:31:42 wigleys Exp $ --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>jsPro - String</title> <script type="text/javascript" src="../error.js"></script> <script type="text/javascript" src="../debug/debug.js"></script> <script type="text/javascript" src="../string.js"></script> <script type="text/javascript" src="test.js"></script> <script type="text/javascript"> var oDebug = new Debug(); var oTest = new Test(); </script> </head> <body> <table> <tbody> <tr> <td colspan="4"><input id="inputString" name="inputString" type="text" size="50" /></td> </tr> <tr> <td>String.addSlashes()</td> <td> </td> <td><input id="addSlashes" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="addSlashesResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.cat()</td> <td> <input id="cat1" name="input" type="text" size="5" /> <input id="cat2" name="input" type="text" size="5" /> </td> <td><input id="cat" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="catResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.compress()</td> <td> </td> <td><input id="compress" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="compressResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.count()</td> <td> </td> <td><input id="count" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="countResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.htmlEntities()</td> <td> </td> <td><input id="htmlEntities" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="htmlEntitiesResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.htmlSpecialChars()</td> <td> </td> <td><input id="htmlSpecialChars" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="htmlSpecialCharsResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.insert()</td> <td> <input id="insert1" name="input" type="text" size="5" /> <input id="insert2" name="input" type="text" size="5" /> </td> <td><input id="insert" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="insertResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.isEmailAddress()</td> <td> </td> <td><input id="isEmailAddress" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="isEmailAddressResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.levenshtein()</td> <td><input id="levenshtein1" name="input" type="text" size="5" /></td> <td><input id="levenshtein" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="levenshteinResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.lpad()</td> <td> <input id="lpad1" name="input" type="text" size="5" /> <input id="lpad2" name="input" type="text" size="5" /> </td> <td><input id="lpad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="lpadResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.ltrim()</td> <td> </td> <td><input id="ltrim" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="ltrimResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.nl2br()</td> <td><input id="nl2br1" name="input" type="text" size="5" /></td> <td><input id="nl2br" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="nl2brResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.overlay()</td> <td> <input id="overlay1" name="input" type="text" size="5" /> <input id="overlay2" name="input" type="text" size="5" /> </td> <td><input id="overlay" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="overlayResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.pad()</td> <td> <input id="pad1" name="input" type="text" size="5" /> <input id="pad2" name="input" type="text" size="5" /> <input id="pad3" name="input" type="text" size="5" /> </td> <td><input id="pad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="padResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.remove()</td> <td> <input id="remove1" name="input" type="text" size="5" /> <input id="remove2" name="input" type="text" size="5" /> </td> <td><input id="remove" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="removeResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.repeat()</td> <td><input id="repeat1" name="input" type="text" size="5" /></td> <td><input id="repeat" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="repeatResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.repeatChars()</td> <td><input id="repeatChars1" name="input" type="text" size="5" /></td> <td><input id="repeatChars" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="repeatCharsResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.reverse()</td> <td> <input id="reverse1" name="input" type="text" size="5" /> <input id="reverse2" name="input" type="text" size="5" /> </td> <td><input id="reverse" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="reverseResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.rot13()</td> <td> </td> <td><input id="rot13" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="rot13Result" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.rpad()</td> <td> <input id="rpad1" name="input" type="text" size="5" /> <input id="rpad2" name="input" type="text" size="5" /> </td> <td><input id="rpad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="rpadResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.rtrim()</td> <td> </td> <td><input id="rtrim" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="rtrimResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.swap()</td> <td> </td> <td><input id="swap" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="swapResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.trim()</td> <td><input id="trim1" name="input" type="text" size="5" /></td> <td><input id="trim" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="trimResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.truncate()</td> <td> <input id="truncate1" name="input" type="text" size="5" /> <input id="truncate2" name="input" type="text" size="5" /> </td> <td><input id="truncate" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="truncateResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.ucFirst()</td> <td> </td> <td><input id="ucFirst" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="ucFirstResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.ucWords()</td> <td> </td> <td><input id="ucWords" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="ucWordsResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>String.wordWrap()</td> <td> <input id="wordWrap1" name="input" type="text" size="5" /> <input id="wordWrap2" name="input" type="text" size="5" /> <input id="wordWrap3" name="input" type="text" size="5" /> </td> <td><input id="wordWrap" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td> <td><input id="wordWrapResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> </tbody> </table> </body> </html> --- NEW FILE: math.html --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- * +-------------------------------------------------------------------------+ * | jsPro - Math Test Page | * +-------------------------------------------------------------------------+ * | Copyright (C) 2001-2003 Stuart Wigley | * +-------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by| * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | * | General Public License for more details. | * | | * | You should have received a copy of the GNU Lesser General Public License| * | along with this library; if not, write to the Free Software Foundation, | * | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * +-------------------------------------------------------------------------+ * | Authors: Stuart Wigley <stu...@ya...> | * +-------------------------------------------------------------------------+ * $Id: math.html,v 1.1 2003/10/13 15:31:42 wigleys Exp $ --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>jsPro - Math</title> <script type="text/javascript" src="../error.js"></script> <script type="text/javascript" src="../debug/debug.js"></script> <script type="text/javascript" src="../math.js"></script> <script type="text/javascript" src="test.js"></script> <script type="text/javascript"> var oDebug = new Debug(); var oTest = new Test(); </script> </head> <body> <table> <tbody> <tr> <td>Math.acosh()</td> <td><input id="acosh1" name="input" type="text" size="5" /></td> <td><input id="acosh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acoshResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.acot()</td> <td><input id="acot1" name="input" type="text" size="5" /></td> <td><input id="acot" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acotResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.acoth()</td> <td><input id="acoth1" name="input" type="text" size="5" /></td> <td><input id="acoth" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acothResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.acov()</td> <td><input id="acov1" name="input" type="text" size="5" /></td> <td><input id="acov" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acovResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.acsc()</td> <td><input id="acsc1" name="input" type="text" size="5" /></td> <td><input id="acsc" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acscResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.acsch()</td> <td><input id="acsch1" name="input" type="text" size="5" /></td> <td><input id="acsch" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="acschResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.aexsec()</td> <td><input id="aexsec1" name="input" type="text" size="5" /></td> <td><input id="aexsec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="aexsecResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.ahav()</td> <td><input id="ahav1" name="input" type="text" size="5" /></td> <td><input id="ahav" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="ahavResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.approx()</td> <td> <input id="approx1" name="input" type="text" size="5" /> <input id="approx2" name="input" type="text" size="5" /> <input id="approx3" name="input" type="text" size="5" /> </td> <td><input id="approx" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="approxResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.arg()</td> <td> <input id="arg1" name="input" type="text" size="5" /> <input id="arg2" name="input" type="text" size="5" /> </td> <td><input id="arg" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="argResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.asec()</td> <td><input id="asec1" name="input" type="text" size="5" /></td> <td><input id="asec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="asecResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.asech()</td> <td><input id="asech1" name="input" type="text" size="5" /></td> <td><input id="asech" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="asechResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.asinh()</td> <td><input id="asinh1" name="input" type="text" size="5" /></td> <td><input id="asinh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="asinhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.atanh()</td> <td><input id="atanh1" name="input" type="text" size="5" /></td> <td><input id="atanh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="atanhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.avers()</td> <td><input id="avers1" name="input" type="text" size="5" /></td> <td><input id="avers" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="aversResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.baseConvert()</td> <td> <input id="baseConvert1" name="input" type="text" size="5" /> <input id="baseConvert2" name="input" type="text" size="5" /> <input id="baseConvert3" name="input" type="text" size="5" /> </td> <td><input id="baseConvert" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="baseConvertResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.bin2dec()</td> <td><input id="bin2dec1" name="input" type="text" size="5" /></td> <td><input id="bin2dec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="bin2decResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.bin2hex()</td> <td><input id="bin2hex1" name="input" type="text" size="5" /></td> <td><input id="bin2hex" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="bin2hexResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.bin2oct()</td> <td><input id="bin2oct1" name="input" type="text" size="5" /></td> <td><input id="bin2oct" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="bin2octResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.coexsec()</td> <td><input id="coexsec1" name="input" type="text" size="5" /></td> <td><input id="coexsec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="coexsecResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.cosh()</td> <td><input id="cosh1" name="input" type="text" size="5" /></td> <td><input id="cosh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="coshResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.cot()</td> <td><input id="cot1" name="input" type="text" size="5" /></td> <td><input id="cot" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="cotResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.coth()</td> <td><input id="coth1" name="input" type="text" size="5" /></td> <td><input id="coth" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="cothResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.cov()</td> <td><input id="cov1" name="input" type="text" size="5" /></td> <td><input id="cov" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="covResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.covh()</td> <td><input id="covh1" name="input" type="text" size="5" /></td> <td><input id="covh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="covhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.csc()</td> <td><input id="csc1" name="input" type="text" size="5" /></td> <td><input id="csc" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="cscResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.csch()</td> <td><input id="csch1" name="input" type="text" size="5" /></td> <td><input id="csch" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="cschResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.dec2bin()</td> <td><input id="dec2bin1" name="input" type="text" size="5" /></td> <td><input id="dec2bin" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="dec2binResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.dec2hex()</td> <td><input id="dec2hex1" name="input" type="text" size="5" /></td> <td><input id="dec2hex" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="dec2hexResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.dec2oct()</td> <td><input id="dec2oct1" name="input" type="text" size="5" /></td> <td><input id="dec2oct" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="dec2octResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.deg2grad()</td> <td><input id="deg2grad1" name="input" type="text" size="5" /></td> <td><input id="deg2grad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="deg2gradResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.deg2rad()</td> <td><input id="deg2rad1" name="input" type="text" size="5" /></td> <td><input id="deg2rad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="deg2radResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.exp10()</td> <td><input id="exp101" name="input" type="text" size="5" /></td> <td><input id="exp10" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="exp10Result" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.expm1()</td> <td><input id="expm11" name="input" type="text" size="5" /></td> <td><input id="expm1" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="expm1Result" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.exsec()</td> <td><input id="exsec1" name="input" type="text" size="5" /></td> <td><input id="exsec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="exsecResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.factorial()</td> <td><input id="factorial1" name="input" type="text" size="5" /></td> <td><input id="factorial" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="factorialResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.fibonacci()</td> <td><input id="fibonacci1" name="input" type="text" size="5" /></td> <td><input id="fibonacci" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="fibonacciResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.fmod()</td> <td> <input id="fmod1" name="input" type="text" size="5" /> <input id="fmod2" name="input" type="text" size="5" /> </td> <td><input id="fmod" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="fmodResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.gd()</td> <td><input id="gd1" name="input" type="text" size="5" /></td> <td><input id="gd" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="gdResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.grad2deg()</td> <td><input id="grad2deg1" name="input" type="text" size="5" /></td> <td><input id="grad2deg" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="grad2degResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.grad2rad()</td> <td><input id="grad2rad1" name="input" type="text" size="5" /></td> <td><input id="grad2rad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="grad2radResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hac()</td> <td><input id="hac1" name="input" type="text" size="5" /></td> <td><input id="hac" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="hacResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hav()</td> <td><input id="hav1" name="input" type="text" size="5" /></td> <td><input id="hav" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="havResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.havh()</td> <td><input id="havh1" name="input" type="text" size="5" /></td> <td><input id="havh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="havhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hex2bin()</td> <td><input id="hex2bin1" name="input" type="text" size="5" /></td> <td><input id="hex2bin" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="hex2binResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hex2dec()</td> <td><input id="hex2dec1" name="input" type="text" size="5" /></td> <td><input id="hex2dec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="hex2decResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hex2oct()</td> <td><input id="hex2oct1" name="input" type="text" size="5" /></td> <td><input id="hex2oct" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="hex2octResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.hypot()</td> <td> <input id="hypot1" name="input" type="text" size="5" /> <input id="hypot2" name="input" type="text" size="5" /> </td> <td><input id="hypot" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="hypotResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.isEven()</td> <td><input id="isEven1" name="input" type="text" size="5" /></td> <td><input id="isEven" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="isEvenResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.isOdd()</td> <td><input id="isOdd1" name="input" type="text" size="5" /></td> <td><input id="isOdd" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="isOddResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.isPrime()</td> <td><input id="isPrime1" name="input" type="text" size="5" /></td> <td><input id="isPrime" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="isPrimeResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.log10()</td> <td><input id="log101" name="input" type="text" size="5" /></td> <td><input id="log10" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="log10Result" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.log2()</td> <td><input id="log21" name="input" type="text" size="5" /></td> <td><input id="log2" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="log2Result" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.log1p()</td> <td><input id="log1p1" name="input" type="text" size="5" /></td> <td><input id="log1p" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="log1pResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.logn()</td> <td> <input id="logn1" name="input" type="text" size="5" /> <input id="logn2" name="input" type="text" size="5" /> </td> <td><input id="logn" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="lognResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.luhn()</td> <td><input id="luhn1" name="input" type="text" size="5" /></td> <td><input id="luhn" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="luhnResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.mantissa()</td> <td><input id="mantissa1" name="input" type="text" size="5" /></td> <td><input id="mantissa" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="mantissaResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.oct2bin()</td> <td><input id="oct2bin1" name="input" type="text" size="5" /></td> <td><input id="oct2bin" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="oct2binResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.oct2dec()</td> <td><input id="oct2dec1" name="input" type="text" size="5" /></td> <td><input id="oct2dec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="oct2decResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.oct2hex()</td> <td><input id="oct2hex1" name="input" type="text" size="5" /></td> <td><input id="oct2hex" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="oct2hexResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.pi()</td> <td><input id="pi1" name="input" type="text" size="5" /></td> <td><input id="pi" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="piResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.rad2deg()</td> <td><input id="rad2deg1" name="input" type="text" size="5" /></td> <td><input id="rad2deg" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="rad2degResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.rad2grad()</td> <td><input id="rad2grad1" name="input" type="text" size="5" /></td> <td><input id="rad2grad" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="rad2gradResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sec()</td> <td><input id="sec1" name="input" type="text" size="5" /></td> <td><input id="sec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="secResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sech()</td> <td><input id="sech1" name="input" type="text" size="5" /></td> <td><input id="sech" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="sechResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sigmoid()</td> <td><input id="sigmoid1" name="input" type="text" size="5" /></td> <td><input id="sigmoid" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="sigmoidResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sign()</td> <td><input id="sign1" name="input" type="text" size="5" /></td> <td><input id="sign" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="signResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sinc()</td> <td><input id="sinc1" name="input" type="text" size="5" /></td> <td><input id="sinc" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="sincResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sinh()</td> <td><input id="sinh1" name="input" type="text" size="5" /></td> <td><input id="sinh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="sinhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.sq()</td> <td><input id="sq1" name="input" type="text" size="5" /></td> <td><input id="sq" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="sqResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.tanc()</td> <td><input id="tanc1" name="input" type="text" size="5" /></td> <td><input id="tanc" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="tancResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.tanh()</td> <td><input id="tanh1" name="input" type="text" size="5" /></td> <td><input id="tanh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="tanhResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.vers()</td> <td><input id="vers1" name="input" type="text" size="5" /></td> <td><input id="vers" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="versResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> <tr> <td>Math.versh()</td> <td><input id="versh1" name="input" type="text" size="5" /></td> <td><input id="versh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td> <td><input id="vershResult" name="output" type="text" size="30" readonly="readonly" /></td> </tr> </tbody> </table> </body> </html> --- NEW FILE: date.html --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- * +-------------------------------------------------------------------------+ * | jsPro - Date Test Page | * +-------------------------------------------------------------------------+ * | Copyright (C) 2001-2003 Stuart Wigley | * +-------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by| * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of ... [truncated message content] |
|
From: <wi...@us...> - 2003-10-13 15:30:56
|
Update of /cvsroot/jspro/jsPro/tests In directory sc8-pr-cvs1:/tmp/cvs-serv2156/tests Log Message: Directory /cvsroot/jspro/jsPro/tests added to the repository |
|
From: <wi...@us...> - 2003-10-13 08:57:50
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv31570
Modified Files:
README math.js CHANGES
Log Message:
three new math methods - versh(), covh(), havh()
Index: README
===================================================================
RCS file: /cvsroot/jspro/jsPro/README,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** README 6 Oct 2003 12:24:05 -0000 1.26
--- README 13 Oct 2003 08:57:46 -0000 1.27
***************
*** 128,218 ****
80. Math.coth(): hyperbolic cotangent
81. Math.cov(): coversine
! 82. Math.csc(): cosecant
! 83. Math.csch(): hyperbolic cosecant
! 84. Math.dec2bin(): decimal to binary conversion
! 85. Math.dec2hex(): decimal to hexadecimal conversion
! 86. Math.dec2oct(): decimal to octal conversion
! 87. Math.deg2grad(): degree to gradian conversion
! 88. Math.deg2rad(): degree to radian conversion
! 89. Math.exp10(): exponent of 10
! 90. Math.expm1(): exp(x) - 1
! 91. Math.exsec(): exsecant
! 92. Math.factorial(): factorial
! 93. Math.fibonacci(): Fibonacci sequence
! 94. Math.fmod(): floating-point remainder
! 95. Math.gd(): Gudermannian function
! 96. Math.grad2deg(): gradian to degree conversion
! 97. Math.grad2rad(): gradian to radian conversion
! 98. Math.hac(): hacoversine
! 99. Math.hav(): haversine
! 100. Math.hex2bin(): hexadecimal to binary conversion
! 101. Math.hex2dec(): hexadecimal to decimal conversion
! 102. Math.hex2oct(): hexadecimal to octal conversion
! 103. Math.hypot(): hypotenuse
! 104. Math.isEven(): is even?
! 105. Math.isOdd(): is odd?
! 106. Math.isPrime(): is prime?
! 107. Math.log10(): base-10 logarithm
! 108. Math.log2(): base-2 logarithm
! 109. Math.log1p(): log(1 + x)
! 110. Math.luhn(): LUHN formula
! 111. Math.mantissa(): mantissa
! 112. Math.oct2bin(): octal to binary conversion
! 113. Math.oct2dec(): octal to decimal conversion
! 114. Math.oct2hex(): octal to hexadecimal conversion
! 115. Math.pi(): calculate pi
! 116. Math.rad2deg(): radian to degree conversion
! 117. Math.rad2grad(): radian to gradian conversion
! 118. Math.sec(): secant
! 119. Math.sech(): hyperbolic secant
! 120. Math.sigmoid(): sigmoid function
! 121. Math.sign(): sign
! 122. Math.sinc(): sinc function
! 123. Math.sinh(): hyperbolic sine
! 124. Math.sq(): square
! 125. Math.tanc(): tanc function
! 126. Math.tanh(): hyperbolic tangent
! 127. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 128. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 129. String.prototype.addSlashes(): escape certain characters with backslashes
! 130. String.prototype.cat(): concatenate
! 131. String.prototype.compress(): compress whitespace to single spaces
! 132. String.prototype.count(): count occurrence of characters
! 133. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 134. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 135. String.prototype.insert(): insert one string into another
! 136. String.prototype.isEmailAddress(): is email address?
! 137. String.prototype.levenshtein(): Levenshtein distance
! 138. String.prototype.lpad(): pad left side
! 139. String.prototype.ltrim(): trim left side
! 140. String.prototype.nl2br(): newline to <br> conversion
! 141. String.prototype.overlay(): overlay one string over another
! 142. String.prototype.pad(): pad
! 143. String.prototype.remove(): remove characters
! 144. String.prototype.repeat(): repeat
! 145. String.prototype.repeatChars(): repeat characters
! 146. String.prototype.reverse(): reverse
! 147. String.prototype.rot13(): rotate 13 encoding
! 148. String.prototype.rpad(): pad right side
! 149. String.prototype.rtrim(): trim right side
! 150. String.prototype.swap(): swap characters
! 151. String.prototype.trim(): trim
! 152. String.prototype.truncate(): truncate
! 153. String.prototype.ucFirst(): uppercase first character
! 154. String.prototype.ucWords(): uppercase words
! 155. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 156. Validator.prototype.isBlankString(): is blank string?
! 157. Validator.prototype.isDigit(): is single digit?
! 158. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Mon Oct 6 13:26:11 2003
\ No newline at end of file
--- 128,221 ----
80. Math.coth(): hyperbolic cotangent
81. Math.cov(): coversine
! 82. Math.covh(): hyperbolic coversine
! 83. Math.csc(): cosecant
! 84. Math.csch(): hyperbolic cosecant
! 85. Math.dec2bin(): decimal to binary conversion
! 86. Math.dec2hex(): decimal to hexadecimal conversion
! 87. Math.dec2oct(): decimal to octal conversion
! 88. Math.deg2grad(): degree to gradian conversion
! 89. Math.deg2rad(): degree to radian conversion
! 90. Math.exp10(): exponent of 10
! 91. Math.expm1(): exp(x) - 1
! 92. Math.exsec(): exsecant
! 93. Math.factorial(): factorial
! 94. Math.fibonacci(): Fibonacci sequence
! 95. Math.fmod(): floating-point remainder
! 96. Math.gd(): Gudermannian function
! 97. Math.grad2deg(): gradian to degree conversion
! 98. Math.grad2rad(): gradian to radian conversion
! 99. Math.hac(): hacoversine
! 100. Math.hav(): haversine
! 101. Math.havh(): hyperbolic haversine
! 102. Math.hex2bin(): hexadecimal to binary conversion
! 103. Math.hex2dec(): hexadecimal to decimal conversion
! 104. Math.hex2oct(): hexadecimal to octal conversion
! 105. Math.hypot(): hypotenuse
! 106. Math.isEven(): is even?
! 107. Math.isOdd(): is odd?
! 108. Math.isPrime(): is prime?
! 109. Math.log10(): base-10 logarithm
! 110. Math.log2(): base-2 logarithm
! 111. Math.log1p(): log(1 + x)
! 112. Math.luhn(): LUHN formula
! 113. Math.mantissa(): mantissa
! 114. Math.oct2bin(): octal to binary conversion
! 115. Math.oct2dec(): octal to decimal conversion
! 116. Math.oct2hex(): octal to hexadecimal conversion
! 117. Math.pi(): calculate pi
! 118. Math.rad2deg(): radian to degree conversion
! 119. Math.rad2grad(): radian to gradian conversion
! 120. Math.sec(): secant
! 121. Math.sech(): hyperbolic secant
! 122. Math.sigmoid(): sigmoid function
! 123. Math.sign(): sign
! 124. Math.sinc(): sinc function
! 125. Math.sinh(): hyperbolic sine
! 126. Math.sq(): square
! 127. Math.tanc(): tanc function
! 128. Math.tanh(): hyperbolic tangent
! 129. Math.vers(): versine
! 130. Math.versh(): hyperbolic versine
point.js
-------------------------------------------------------------------------------
! 131. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 132. String.prototype.addSlashes(): escape certain characters with backslashes
! 133. String.prototype.cat(): concatenate
! 134. String.prototype.compress(): compress whitespace to single spaces
! 135. String.prototype.count(): count occurrence of characters
! 136. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 137. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 138. String.prototype.insert(): insert one string into another
! 139. String.prototype.isEmailAddress(): is email address?
! 140. String.prototype.levenshtein(): Levenshtein distance
! 141. String.prototype.lpad(): pad left side
! 142. String.prototype.ltrim(): trim left side
! 143. String.prototype.nl2br(): newline to <br> conversion
! 144. String.prototype.overlay(): overlay one string over another
! 145. String.prototype.pad(): pad
! 146. String.prototype.remove(): remove characters
! 147. String.prototype.repeat(): repeat
! 148. String.prototype.repeatChars(): repeat characters
! 149. String.prototype.reverse(): reverse
! 150. String.prototype.rot13(): rotate 13 encoding
! 151. String.prototype.rpad(): pad right side
! 152. String.prototype.rtrim(): trim right side
! 153. String.prototype.swap(): swap characters
! 154. String.prototype.trim(): trim
! 155. String.prototype.truncate(): truncate
! 156. String.prototype.ucFirst(): uppercase first character
! 157. String.prototype.ucWords(): uppercase words
! 158. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 159. Validator.prototype.isBlankString(): is blank string?
! 160. Validator.prototype.isDigit(): is single digit?
! 161. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Mon Oct 13 09:54:52 2003
\ No newline at end of file
Index: math.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/math.js,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** math.js 6 Oct 2003 12:21:32 -0000 1.25
--- math.js 13 Oct 2003 08:57:46 -0000 1.26
***************
*** 1166,1169 ****
--- 1166,1213 ----
/**
+ * Calculates and returns the hyperbolic coversine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary hyperbolic coversine
+ * @author Stuart Wigley
+ * @version 1.0, 10/13/03
+ * @interface <code>Math.covh(fX)</code>
+ * @param fX a floating-point number
+ * @return the hyperbolic coversine of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.covh = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.covh', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.covh', 'number', typeof fX);
+ }
+
+ var fHypCoversine = 1 - ((Math.exp(fX) - Math.exp(-fX)) / 2);
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fHypCoversine;
+ }
+ }
+
+
+ /**
* Calculates and returns the cosecant of a number in 2D Cartesian space.
*
***************
*** 1969,1972 ****
--- 2013,2060 ----
/**
+ * Calculates and returns the hyperbolic haversine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary hyperbolic haversine
+ * @author Stuart Wigley
+ * @version 1.0, 10/13/03
+ * @interface <code>Math.havh(fX)</code>
+ * @param fX a floating-point number
+ * @return the hyperbolic haversine of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.havh = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.havh', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.havh', 'number', typeof fX);
+ }
+
+ var fHypHaversine = (1 - ((Math.exp(fX) + Math.exp(-fX)) / 2)) / 2;
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fHypHaversine;
+ }
+ }
+
+
+ /**
* Converts a hexadecimal number into its binary equivalent.
*
***************
*** 3281,3284 ****
--- 3369,3416 ----
return vError ? null : fVersine;
+ }
+ }
+
+
+ /**
+ * Calculates and returns the hyperbolic versine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary hyperbolic versine
+ * @author Stuart Wigley
+ * @version 1.0, 10/13/03
+ * @interface <code>Math.versh(fX)</code>
+ * @param fX a floating-point number
+ * @return the hyperbolic versine of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.versh = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.versh', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.versh', 'number', typeof fX);
+ }
+
+ var fHypVersine = 1 - ((Math.exp(fX) + Math.exp(-fX)) / 2);
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fHypVersine;
}
}
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** CHANGES 6 Oct 2003 12:21:32 -0000 1.21
--- CHANGES 13 Oct 2003 08:57:46 -0000 1.22
***************
*** 1,4 ****
===============================================================================
! Whats new in R2? (Not Released Yet)
===============================================================================
--- 1,4 ----
===============================================================================
! Whats new in R4? (Not Released Yet)
===============================================================================
***************
*** 12,18 ****
--- 12,21 ----
- Math.avers()
- Math.coexsec()
+ - Math.covh()
- Math.factorial()
- Math.hac()
+ - Math.havh()
- Math.mantissa()
+ - Math.versh()
===============================================================================
|
|
From: <wi...@us...> - 2003-10-13 08:57:50
|
Update of /cvsroot/jspro/jsPro/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv31570/docs
Modified Files:
math.html
Log Message:
three new math methods - versh(), covh(), havh()
Index: math.html
===================================================================
RCS file: /cvsroot/jspro/jsPro/docs/math.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** math.html 6 Oct 2003 12:21:32 -0000 1.10
--- math.html 13 Oct 2003 08:57:46 -0000 1.11
***************
*** 196,199 ****
--- 196,205 ----
</tr>
<tr>
+ <td>Math.covh()</td>
+ <td><input id="covh1" name="input" type="text" size="5" /></td>
+ <td><input id="covh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="covhResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.csc()</td>
<td><input id="csc1" name="input" type="text" size="5" /></td>
***************
*** 307,310 ****
--- 313,322 ----
</tr>
<tr>
+ <td>Math.havh()</td>
+ <td><input id="havh1" name="input" type="text" size="5" /></td>
+ <td><input id="havh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="havhResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.hex2bin()</td>
<td><input id="hex2bin1" name="input" type="text" size="5" /></td>
***************
*** 485,488 ****
--- 497,506 ----
<td><input id="vers" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
<td><input id="versResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Math.versh()</td>
+ <td><input id="versh1" name="input" type="text" size="5" /></td>
+ <td><input id="versh" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="vershResult" name="output" type="text" size="30" readonly="readonly" /></td>
</tr>
</tbody>
|
|
From: <wi...@us...> - 2003-10-06 12:24:13
|
Update of /cvsroot/jspro/jsPro In directory sc8-pr-cvs1:/tmp/cvs-serv21236 Modified Files: README Log Message: Updated to reflect new additions Index: README =================================================================== RCS file: /cvsroot/jspro/jsPro/README,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** README 1 Oct 2003 10:02:13 -0000 1.25 --- README 6 Oct 2003 12:24:05 -0000 1.26 *************** *** 107,212 **** 59. Math.acot(): inverse cotangent 60. Math.acoth(): inverse hyperbolic cotangent ! 61. Math.acsc(): inverse cosecant ! 62. Math.acsch(): inverse hyperbolic cosecant ! 63. Math.approx(): approximately equal ! 64. Math.arg(): polar angle (argument) ! 65. Math.asec(): inverse secant ! 66. Math.asech(): inverse hyperbolic secant ! 67. Math.asinh(): inverse hyperbolic sine ! 68. Math.atanh(): inverse hyperbolic tangent ! 69. Math.baseConvert(): convert base ! 70. Math.bin2dec(): binary to decimal conversion ! 71. Math.bin2hex(): binary to hexadecimal conversion ! 72. Math.bin2oct(): binary to octal conversion ! 73. Math.cosh(): hyperbolic cosine ! 74. Math.cot(): cotangent ! 75. Math.coth(): hyperbolic cotangent ! 76. Math.cov(): coversine ! 77. Math.csc(): cosecant ! 78. Math.csch(): hyperbolic cosecant ! 79. Math.dec2bin(): decimal to binary conversion ! 80. Math.dec2hex(): decimal to hexadecimal conversion ! 81. Math.dec2oct(): decimal to octal conversion ! 82. Math.deg2grad(): degree to gradian conversion ! 83. Math.deg2rad(): degree to radian conversion ! 84. Math.exp10(): exponent of 10 ! 85. Math.expm1(): exp(x) - 1 ! 86. Math.exsec(): exsecant ! 87. Math.fibonacci(): Fibonacci sequence ! 88. Math.fmod(): floating-point remainder ! 89. Math.gd(): Gudermannian function ! 90. Math.grad2deg(): gradian to degree conversion ! 91. Math.grad2rad(): gradian to radian conversion ! 92. Math.hav(): haversine ! 93. Math.hex2bin(): hexadecimal to binary conversion ! 94. Math.hex2dec(): hexadecimal to decimal conversion ! 95. Math.hex2oct(): hexadecimal to octal conversion ! 96. Math.hypot(): hypotenuse ! 97. Math.isEven(): is even? ! 98. Math.isOdd(): is odd? ! 99. Math.isPrime(): is prime? ! 100. Math.log10(): base-10 logarithm ! 101. Math.log2(): base-2 logarithm ! 102. Math.log1p(): log(1 + x) ! 103. Math.luhn(): LUHN formula ! 104. Math.oct2bin(): octal to binary conversion ! 105. Math.oct2dec(): octal to decimal conversion ! 106. Math.oct2hex(): octal to hexadecimal conversion ! 107. Math.pi(): calculate pi ! 108. Math.rad2deg(): radian to degree conversion ! 109. Math.rad2grad(): radian to gradian conversion ! 110. Math.sec(): secant ! 111. Math.sech(): hyperbolic secant ! 112. Math.sigmoid(): sigmoid function ! 113. Math.sign(): sign ! 114. Math.sinc(): sinc function ! 115. Math.sinh(): hyperbolic sine ! 116. Math.sq(): square ! 117. Math.tanc(): tanc function ! 118. Math.tanh(): hyperbolic tangent ! 119. Math.vers(): versine point.js ------------------------------------------------------------------------------- ! 120. Point.prototype.distance(): distance between two points string.js ------------------------------------------------------------------------------- ! 121. String.prototype.addSlashes(): escape certain characters with backslashes ! 122. String.prototype.cat(): concatenate ! 123. String.prototype.compress(): compress whitespace to single spaces ! 124. String.prototype.count(): count occurrence of characters ! 125. String.prototype.htmlEntities(): encode XHTML 1.0 entities ! 126. String.prototype.htmlSpecialChars(): encode subset of HTML special characters ! 127. String.prototype.insert(): insert one string into another ! 128. String.prototype.isEmailAddress(): is email address? ! 129. String.prototype.levenshtein(): Levenshtein distance ! 130. String.prototype.lpad(): pad left side ! 131. String.prototype.ltrim(): trim left side ! 132. String.prototype.nl2br(): newline to <br> conversion ! 133. String.prototype.overlay(): overlay one string over another ! 134. String.prototype.pad(): pad ! 135. String.prototype.remove(): remove characters ! 136. String.prototype.repeat(): repeat ! 137. String.prototype.repeatChars(): repeat characters ! 138. String.prototype.reverse(): reverse ! 139. String.prototype.rot13(): rotate 13 encoding ! 140. String.prototype.rpad(): pad right side ! 141. String.prototype.rtrim(): trim right side ! 142. String.prototype.swap(): swap characters ! 143. String.prototype.trim(): trim ! 144. String.prototype.truncate(): truncate ! 145. String.prototype.ucFirst(): uppercase first character ! 146. String.prototype.ucWords(): uppercase words ! 147. String.prototype.wordWrap(): word wrap validator.js ------------------------------------------------------------------------------- ! 148. Validator.prototype.isBlankString(): is blank string? ! 149. Validator.prototype.isDigit(): is single digit? ! 150. Validator.prototype.isInteger(): is integer? ! ! - This file was generated automatically: Wed Oct 1 11:03:32 2003 --- 107,218 ---- 59. Math.acot(): inverse cotangent 60. Math.acoth(): inverse hyperbolic cotangent ! 61. Math.acov(): inverse coversine ! 62. Math.acsc(): inverse cosecant ! 63. Math.acsch(): inverse hyperbolic cosecant ! 64. Math.aexsec(): inverse exsecant ! 65. Math.ahav(): inverse haversine ! 66. Math.approx(): approximately equal ! 67. Math.arg(): polar angle (argument) ! 68. Math.asec(): inverse secant ! 69. Math.asech(): inverse hyperbolic secant ! 70. Math.asinh(): inverse hyperbolic sine ! 71. Math.atanh(): inverse hyperbolic tangent ! 72. Math.avers(): inverse versine ! 73. Math.baseConvert(): convert base ! 74. Math.bin2dec(): binary to decimal conversion ! 75. Math.bin2hex(): binary to hexadecimal conversion ! 76. Math.bin2oct(): binary to octal conversion ! 77. Math.coexsec(): coexsecant ! 78. Math.cosh(): hyperbolic cosine ! 79. Math.cot(): cotangent ! 80. Math.coth(): hyperbolic cotangent ! 81. Math.cov(): coversine ! 82. Math.csc(): cosecant ! 83. Math.csch(): hyperbolic cosecant ! 84. Math.dec2bin(): decimal to binary conversion ! 85. Math.dec2hex(): decimal to hexadecimal conversion ! 86. Math.dec2oct(): decimal to octal conversion ! 87. Math.deg2grad(): degree to gradian conversion ! 88. Math.deg2rad(): degree to radian conversion ! 89. Math.exp10(): exponent of 10 ! 90. Math.expm1(): exp(x) - 1 ! 91. Math.exsec(): exsecant ! 92. Math.factorial(): factorial ! 93. Math.fibonacci(): Fibonacci sequence ! 94. Math.fmod(): floating-point remainder ! 95. Math.gd(): Gudermannian function ! 96. Math.grad2deg(): gradian to degree conversion ! 97. Math.grad2rad(): gradian to radian conversion ! 98. Math.hac(): hacoversine ! 99. Math.hav(): haversine ! 100. Math.hex2bin(): hexadecimal to binary conversion ! 101. Math.hex2dec(): hexadecimal to decimal conversion ! 102. Math.hex2oct(): hexadecimal to octal conversion ! 103. Math.hypot(): hypotenuse ! 104. Math.isEven(): is even? ! 105. Math.isOdd(): is odd? ! 106. Math.isPrime(): is prime? ! 107. Math.log10(): base-10 logarithm ! 108. Math.log2(): base-2 logarithm ! 109. Math.log1p(): log(1 + x) ! 110. Math.luhn(): LUHN formula ! 111. Math.mantissa(): mantissa ! 112. Math.oct2bin(): octal to binary conversion ! 113. Math.oct2dec(): octal to decimal conversion ! 114. Math.oct2hex(): octal to hexadecimal conversion ! 115. Math.pi(): calculate pi ! 116. Math.rad2deg(): radian to degree conversion ! 117. Math.rad2grad(): radian to gradian conversion ! 118. Math.sec(): secant ! 119. Math.sech(): hyperbolic secant ! 120. Math.sigmoid(): sigmoid function ! 121. Math.sign(): sign ! 122. Math.sinc(): sinc function ! 123. Math.sinh(): hyperbolic sine ! 124. Math.sq(): square ! 125. Math.tanc(): tanc function ! 126. Math.tanh(): hyperbolic tangent ! 127. Math.vers(): versine point.js ------------------------------------------------------------------------------- ! 128. Point.prototype.distance(): distance between two points string.js ------------------------------------------------------------------------------- ! 129. String.prototype.addSlashes(): escape certain characters with backslashes ! 130. String.prototype.cat(): concatenate ! 131. String.prototype.compress(): compress whitespace to single spaces ! 132. String.prototype.count(): count occurrence of characters ! 133. String.prototype.htmlEntities(): encode XHTML 1.0 entities ! 134. String.prototype.htmlSpecialChars(): encode subset of HTML special characters ! 135. String.prototype.insert(): insert one string into another ! 136. String.prototype.isEmailAddress(): is email address? ! 137. String.prototype.levenshtein(): Levenshtein distance ! 138. String.prototype.lpad(): pad left side ! 139. String.prototype.ltrim(): trim left side ! 140. String.prototype.nl2br(): newline to <br> conversion ! 141. String.prototype.overlay(): overlay one string over another ! 142. String.prototype.pad(): pad ! 143. String.prototype.remove(): remove characters ! 144. String.prototype.repeat(): repeat ! 145. String.prototype.repeatChars(): repeat characters ! 146. String.prototype.reverse(): reverse ! 147. String.prototype.rot13(): rotate 13 encoding ! 148. String.prototype.rpad(): pad right side ! 149. String.prototype.rtrim(): trim right side ! 150. String.prototype.swap(): swap characters ! 151. String.prototype.trim(): trim ! 152. String.prototype.truncate(): truncate ! 153. String.prototype.ucFirst(): uppercase first character ! 154. String.prototype.ucWords(): uppercase words ! 155. String.prototype.wordWrap(): word wrap validator.js ------------------------------------------------------------------------------- ! 156. Validator.prototype.isBlankString(): is blank string? ! 157. Validator.prototype.isDigit(): is single digit? ! 158. Validator.prototype.isInteger(): is integer? + This file was generated automatically: Mon Oct 6 13:26:11 2003 \ No newline at end of file |
|
From: <wi...@us...> - 2003-10-06 12:22:23
|
Update of /cvsroot/jspro/jsPro/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv20997
Added Files:
createREADME.pl
Log Message:
new README generation script
--- NEW FILE: createREADME.pl ---
#!/usr/bin/perl -w
# +-------------------------------------------------------------------------+
# | jsPro - README Creation Script |
# +-------------------------------------------------------------------------+
# | Copyright (C) 2001-2003 Stuart Wigley |
# +-------------------------------------------------------------------------+
# | This library is free software; you can redistribute it and/or modify it |
# | under the terms of the GNU Lesser General Public License as published by|
# | the Free Software Foundation; either version 2.1 of the License, or (at |
# | your option) any later version. |
# | |
# | This library is distributed in the hope that it will be useful, but |
# | WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
# | General Public License for more details. |
# | |
# | You should have received a copy of the GNU Lesser General Public License|
# | along with this library; if not, write to the Free Software Foundation, |
# | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# +-------------------------------------------------------------------------+
# | Authors: Stuart Wigley <stu...@ya...> |
# +-------------------------------------------------------------------------+
# $Id: createREADME.pl,v 1.1 2003/10/06 12:22:19 wigleys Exp $
use strict;
# get the number of command line arguments
my $iNumArgs = $#ARGV + 1;
# where to look for the javascript files
my $jsFolder = "..";
if ($iNumArgs != 0) {
print "ERROR: Unexpected argument(s)\n";
} else {
&README;
}
exit;
#this subroutine generates the README file output
sub README {
&README_INTRO;
opendir(DIR, $jsFolder);
my $counter = 1;
my $sShortDesc;
while (my $filename = readdir(DIR)) {
if ($filename =~ m/\.js$/) {
open( FILE, "< $jsFolder/$filename" ) or die "Can't open $filename : $!";
print "$filename\n";
print "-------------------------------------------------------------------------------\n";
# for each line of the file
while (<FILE>) {
# remove the trailing newline character
chomp;
# get the @shortDesc value
if (m/\@summary(\s*)/) {
$sShortDesc = $';
}
# if the current line is a function definition
if (m/function\(/) {
# match the " =" on this line
/ \=/;
# print the output line and increment
print $counter . ". " . $` . "(): " . $sShortDesc . "\n";
$counter++;
# reset the shortDescription value ready for the next iteration
$sShortDesc = "";
}
}
print "\n";
close FILE;
}
}
&FOOTER;
}
# this subroutine prints the standard README header
sub README_INTRO {
print
"*******************************************************************************
* This software is OSI Certified Open Source Software. *
* OSI Certified is a certification mark of the Open Source Initiative. *
*******************************************************************************
jsPro by Stuart Wigley and Randolph T. Fielding
-------------------------------------------------------------------------------
jsPro is a set of object-based libraries that extend JavaScript with rich new
functionality. jsPro provides methods that extend the core classes (ie String,
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
In addition jsPro is developed to a high coding standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
A lot of the methods used in these libraries have been inspired by functions
already available in PHP and other programming languages.
The aim of the project is simply to make jsPro the benchmark for high quality,
object-based functionality in JavaScript.
All improvements, suggestions, new methods and bug reports are welcome.
The following is a list of what has been implemented so far:
";
}
# this subroutine inserts a standard footer
sub FOOTER {
my $localTime = localtime();
print
"
This file was generated automatically: $localTime";
}
|
|
From: <wi...@us...> - 2003-10-06 12:21:36
|
Update of /cvsroot/jspro/jsPro/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv20844/docs
Modified Files:
math.html
Log Message:
8 new mathematical methods
Index: math.html
===================================================================
RCS file: /cvsroot/jspro/jsPro/docs/math.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** math.html 24 Sep 2003 13:10:23 -0000 1.9
--- math.html 6 Oct 2003 12:21:32 -0000 1.10
***************
*** 59,62 ****
--- 59,68 ----
</tr>
<tr>
+ <td>Math.acov()</td>
+ <td><input id="acov1" name="input" type="text" size="5" /></td>
+ <td><input id="acov" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="acovResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.acsc()</td>
<td><input id="acsc1" name="input" type="text" size="5" /></td>
***************
*** 71,74 ****
--- 77,92 ----
</tr>
<tr>
+ <td>Math.aexsec()</td>
+ <td><input id="aexsec1" name="input" type="text" size="5" /></td>
+ <td><input id="aexsec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="aexsecResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Math.ahav()</td>
+ <td><input id="ahav1" name="input" type="text" size="5" /></td>
+ <td><input id="ahav" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="ahavResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.approx()</td>
<td>
***************
*** 114,117 ****
--- 132,141 ----
</tr>
<tr>
+ <td>Math.avers()</td>
+ <td><input id="avers1" name="input" type="text" size="5" /></td>
+ <td><input id="avers" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="aversResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.baseConvert()</td>
<td>
***************
*** 142,145 ****
--- 166,175 ----
</tr>
<tr>
+ <td>Math.coexsec()</td>
+ <td><input id="coexsec1" name="input" type="text" size="5" /></td>
+ <td><input id="coexsec" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="coexsecResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.cosh()</td>
<td><input id="cosh1" name="input" type="text" size="5" /></td>
***************
*** 226,229 ****
--- 256,265 ----
</tr>
<tr>
+ <td>Math.factorial()</td>
+ <td><input id="factorial1" name="input" type="text" size="5" /></td>
+ <td><input id="factorial" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="factorialResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.fibonacci()</td>
<td><input id="fibonacci1" name="input" type="text" size="5" /></td>
***************
*** 259,262 ****
--- 295,304 ----
</tr>
<tr>
+ <td>Math.hac()</td>
+ <td><input id="hac1" name="input" type="text" size="5" /></td>
+ <td><input id="hac" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="hacResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.hav()</td>
<td><input id="hav1" name="input" type="text" size="5" /></td>
***************
*** 341,344 ****
--- 383,392 ----
<td><input id="luhn" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
<td><input id="luhnResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Math.mantissa()</td>
+ <td><input id="mantissa1" name="input" type="text" size="5" /></td>
+ <td><input id="mantissa" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="mantissaResult" name="output" type="text" size="30" readonly="readonly" /></td>
</tr>
<tr>
|
|
From: <wi...@us...> - 2003-10-06 12:21:36
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv20844
Modified Files:
math.js CHANGES
Log Message:
8 new mathematical methods
Index: math.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/math.js,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** math.js 24 Sep 2003 13:10:23 -0000 1.24
--- math.js 6 Oct 2003 12:21:32 -0000 1.25
***************
*** 165,168 ****
--- 165,213 ----
/**
+ * Calculates and returns the inverse coversine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary inverse coversine
+ * @author Stuart Wigley
+ * @version 1.0, 10/09/03
+ * @interface <code>Math.acov(fX)</code>
+ * @param fX a floating-point number
+ * @return the inverse coversine of <code>fX</code> in radians
+ * @return <code>NaN</code> if <code>0 < fX < 2</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.acov = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.acov', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.acov', 'number', typeof fX);
+ }
+
+ var fInvCoversine = Math.atan((1 - fX) / Math.sqrt(2 * fX - fX * fX));
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fInvCoversine;
+ }
+ }
+
+
+ /**
* Calculates and returns the inverse cosecant of a number in 2D Cartesian
* space.
***************
*** 257,260 ****
--- 302,395 ----
/**
+ * Calculates and returns the inverse exsecant of a number in 2D Cartesian
+ * space.
+ *
+ * @summary inverse exsecant
+ * @author Stuart Wigley
+ * @version 1.0, 10/06/03
+ * @interface <code>Math.aexsec(fX)</code>
+ * @param fX a floating-point number
+ * @return the inverse exsecant of <code>fX</code>
+ * @return <code>NaN</code> if <code>-2 < fX < 0</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.aexsec = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.aexsec', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.aexsec', 'number', typeof fX);
+ }
+
+ var fInvExsecant = Math.atan(Math.sqrt((fX * fX) + (2 * fX)));
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fInvExsecant;
+ }
+ }
+
+
+ /**
+ * Calculates and returns the inverse haversine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary inverse haversine
+ * @author Stuart Wigley
+ * @version 1.0, 10/09/03
+ * @interface <code>Math.ahav(fX)</code>
+ * @param fX a floating-point number
+ * @return the inverse haversine of <code>fX</code> in radians
+ * @return <code>NaN</code> if <code>0 < fX < 1</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.ahav = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.ahav', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.ahav', 'number', typeof fX);
+ }
+
+ var fInvHaversine = Math.atan(2 * Math.sqrt(fX - fX * fX) / (1 - 2 * fX)) ;
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fInvHaversine;
+ }
+ }
+
+
+ /**
* Calculates if two numbers are approximately equal. Approximation defaults
* to +/- 0.01 but can be optionally set using the <code>fEpsilon</code>
***************
*** 561,564 ****
--- 696,744 ----
/**
+ * Calculates and returns the inverse versine of a number in 2D Cartesian
+ * space.
+ *
+ * @summary inverse versine
+ * @author Stuart Wigley
+ * @version 1.0, 10/02/03
+ * @interface <code>Math.avers(fX)</code>
+ * @param fX a floating-point number
+ * @return the inverse versine of <code>fX</code>
+ * @return <code>NaN</code> if <code>0 < fX < 2</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.avers = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.avers', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.avers', 'number', typeof fX);
+ }
+
+ var fAvers = Math.atan(Math.sqrt(2 * fX - fX * fX) / (1 - fX));
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fAvers;
+ }
+ }
+
+
+ /**
* Converts a number from one base to another base.
*
***************
*** 765,768 ****
--- 945,991 ----
/**
+ * Calculates and returns the coexsecant of a number in 2D Cartesian space.
+ *
+ * @summary coexsecant
+ * @author Stuart Wigley
+ * @version 1.0, 10/02/03
+ * @interface <code>Math.coexsec(fX)</code>
+ * @param fX a floating-point number
+ * @return the coexsecant of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.coexsec = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.coexsec', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.coexsec', 'number', typeof fX);
+ }
+
+ var fCoexsecant = (1 / Math.sin(fX)) - 1;
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fCoexsecant;
+ }
+ }
+
+
+ /**
* Calculates and returns the hyperbolic cosine of a number in 2D Cartesian
* space.
***************
*** 1383,1386 ****
--- 1606,1656 ----
/**
+ * Calculates and returns the factorial of a number.
+ *
+ * @summary factorial
+ * @author Stuart Wigley
+ * @version 1.0, 10/02/03
+ * @interface <code>Math.factorial(iX)</code>
+ * @param fX an integer
+ * @return the factorial of <code>iX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.factorial = function(iX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.factorial', 1, iNumArguments);
+ }
+
+ if ((typeof iX != 'number') || (iX.toString().indexOf('.') != -1)) {
+ throw vError = new TypeMismatchException('Math.factorial', 'integer', typeof iX);
+ }
+
+ var iFactorial = 1;
+
+ for (var i = 1; i <= iX; i++) {
+ iFactorial *= i;
+ }
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : iFactorial;
+ }
+ }
+
+
+ /**
* Calculates and returns the xth term of the Fibonacci sequence.
*
***************
*** 1612,1615 ****
--- 1882,1928 ----
/**
+ * Calculates and returns the hacoversine of a number in 2D Cartesian space.
+ *
+ * @summary hacoversine
+ * @author Stuart Wigley
+ * @version 1.0, 10/02/03
+ * @interface <code>Math.hac(fX)</code>
+ * @param fX a floating-point number
+ * @return the hacoversine of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.hac = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.hac', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.hac', 'number', typeof fX);
+ }
+
+ var fHacoversine = (1 - Math.sin(fX)) / 2;
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fHacoversine;
+ }
+ }
+
+
+ /**
* Calculates and returns the haversine of a number in 2D Cartesian space.
*
***************
*** 2187,2190 ****
--- 2500,2554 ----
return vError ? null : bIsValidLuhn;
+ }
+ }
+
+
+ /**
+ * Returns the mantissa part of a floating point number, or zero for an integer.
+ *
+ * @summary mantissa
+ * @author Stuart Wigley
+ * @version 1.0, 10/01/03
+ * @interface <code>Math.mantissa(fX)</code>
+ * @param fX a floating-point number
+ * @return the mantissa part of a floating point number
+ * @return zero for an integer
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.mantissa = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.mantissa', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.mantissa', 'number', typeof fX);
+ }
+
+ var fMantissa = 0;
+ var absfX = Math.abs(fX);
+
+ if (fX.toString().indexOf('.') != -1) {
+ //FIXME:
+ // 67.8 - 67 = 0.7999999999999972
+ fMantissa = absfX - Math.floor(absfX);
+ }
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fMantissa;
}
}
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** CHANGES 1 Oct 2003 10:02:14 -0000 1.20
--- CHANGES 6 Oct 2003 12:21:32 -0000 1.21
***************
*** 1,4 ****
===============================================================================
! Whats new in R3? (01 Oct 2003)
===============================================================================
--- 1,21 ----
===============================================================================
! Whats new in R2? (Not Released Yet)
! ===============================================================================
!
! Additions:
!
! math.js:
!
! - Math.acov()
! - Math.aexsec()
! - Math.ahav()
! - Math.avers()
! - Math.coexsec()
! - Math.factorial()
! - Math.hac()
! - Math.mantissa()
!
! ===============================================================================
! Whats new in R3? (Released 01 Oct 2003)
===============================================================================
|
|
From: <wi...@us...> - 2003-10-02 14:25:28
|
Update of /cvsroot/jspro/jsPro/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv17756 Removed Files: jsDoc.pl Log Message: to be replaced by createREADME.pl --- jsDoc.pl DELETED --- |
|
From: <wi...@us...> - 2003-10-01 14:51:01
|
Update of /cvsroot/jspro/jsPro/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv30135
Modified Files:
jsDoc.pl
Log Message:
Some minor tweeks to make sure that the script does actually work
Index: jsDoc.pl
===================================================================
RCS file: /cvsroot/jspro/jsPro/scripts/jsDoc.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** jsDoc.pl 1 Oct 2003 14:42:58 -0000 1.1
--- jsDoc.pl 1 Oct 2003 14:50:53 -0000 1.2
***************
*** 1,7 ****
--- 1,33 ----
#!/usr/bin/perl -w
+ # +-------------------------------------------------------------------------+
+ # | jsPro - Documentation Script |
+ # +-------------------------------------------------------------------------+
+ # | Copyright (C) 2001-2003 Stuart Wigley |
+ # +-------------------------------------------------------------------------+
+ # | This library is free software; you can redistribute it and/or modify it |
+ # | under the terms of the GNU Lesser General Public License as published by|
+ # | the Free Software Foundation; either version 2.1 of the License, or (at |
+ # | your option) any later version. |
+ # | |
+ # | This library is distributed in the hope that it will be useful, but |
+ # | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ # | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
+ # | General Public License for more details. |
+ # | |
+ # | You should have received a copy of the GNU Lesser General Public License|
+ # | along with this library; if not, write to the Free Software Foundation, |
+ # | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ # +-------------------------------------------------------------------------+
+ # | Authors: Stuart Wigley <stu...@ya...> |
+ # +-------------------------------------------------------------------------+
+ # $Id$
+
use strict;
+ # get the number of command line arguments
my $iNumArgs = $#ARGV + 1;
+ # where to look for the javascript files
+ my $jsFolder = "..";
if ($iNumArgs != 1) {
***************
*** 27,31 ****
&README_INTRO;
! opendir(DIR, ".");
my $counter = 1;
--- 53,57 ----
&README_INTRO;
! opendir(DIR, $jsFolder);
my $counter = 1;
***************
*** 36,47 ****
if ($filename =~ m/\.js$/) {
! open( FILE, "< $filename" ) or die "Can't open $filename : $!";
print "$filename\n";
print "-------------------------------------------------------------------------------\n";
! #for each line of the file
while (<FILE>) {
chomp;
--- 62,74 ----
if ($filename =~ m/\.js$/) {
! open( FILE, "< $jsFolder/$filename" ) or die "Can't open $filename : $!";
print "$filename\n";
print "-------------------------------------------------------------------------------\n";
! # for each line of the file
while (<FILE>) {
+ # remove the trailing newline character
chomp;
***************
*** 54,64 ****
if ($_ =~ m/function\(/) {
! #match the " =" on this line
/ \=/;
! #print the output line
print $counter . ". " . $` . "(): " . $sShortDesc . "\n";
$counter++;
! #reset the shortDescription value ready for the next iteration
$sShortDesc = "";
}
--- 81,91 ----
if ($_ =~ m/function\(/) {
! # match the " =" on this line
/ \=/;
! # print the output line and increment
print $counter . ". " . $` . "(): " . $sShortDesc . "\n";
$counter++;
! # reset the shortDescription value ready for the next iteration
$sShortDesc = "";
}
***************
*** 73,77 ****
! #this subroutine prints the standard README header
sub README_INTRO {
print
--- 100,104 ----
! # this subroutine prints the standard README header
sub README_INTRO {
print
***************
*** 105,109 ****
! #this subroutine inserts a standard footer
sub FOOTER {
my $localTime = localtime();
--- 132,136 ----
! # this subroutine inserts a standard footer
sub FOOTER {
my $localTime = localtime();
***************
*** 116,120 ****
! #this subroutine displays help on the script
sub HELP {
die
--- 143,147 ----
! # this subroutine displays help on the script
sub HELP {
die
***************
*** 122,125 ****
Example: jsDoc -r\n
-r, --readme generate README file for all JavaScript files in current
! directory\n";
}
--- 149,152 ----
Example: jsDoc -r\n
-r, --readme generate README file for all JavaScript files in current
! directory\n";
}
|
|
From: <wi...@us...> - 2003-10-01 14:43:02
|
Update of /cvsroot/jspro/jsPro/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv28704
Added Files:
jsDoc.pl
Log Message:
A simple Perl script that can be used to generate the README file
--- NEW FILE: jsDoc.pl ---
#!/usr/bin/perl -w
use strict;
my $iNumArgs = $#ARGV + 1;
if ($iNumArgs != 1) {
print "ERROR: Expected 1 argument but got $iNumArgs argument(s)\n\n";
&HELP;
} else {
my $sDocType = $ARGV[0];
if ($sDocType eq "-r" || $sDocType eq "--readme") {
&README;
} else {
print "ERROR: Unknown command line argument: \"$sDocType\"\n\n";
&HELP;
}
}
exit;
#this subroutine generates the README file output
sub README {
&README_INTRO;
opendir(DIR, ".");
my $counter = 1;
my $sShortDesc;
while (my $filename = readdir(DIR)) {
if ($filename =~ m/\.js$/) {
open( FILE, "< $filename" ) or die "Can't open $filename : $!";
print "$filename\n";
print "-------------------------------------------------------------------------------\n";
#for each line of the file
while (<FILE>) {
chomp;
# get the @shortDesc value
if ($_ =~ m/\@summary(\s*)/) {
$sShortDesc = $';
}
# if the current line is a function definition
if ($_ =~ m/function\(/) {
#match the " =" on this line
/ \=/;
#print the output line
print $counter . ". " . $` . "(): " . $sShortDesc . "\n";
$counter++;
#reset the shortDescription value ready for the next iteration
$sShortDesc = "";
}
}
print "\n";
close FILE;
}
}
&FOOTER;
}
#this subroutine prints the standard README header
sub README_INTRO {
print
"*******************************************************************************
* This software is OSI Certified Open Source Software. *
* OSI Certified is a certification mark of the Open Source Initiative. *
*******************************************************************************
jsPro by Stuart Wigley and Randolph T. Fielding
-------------------------------------------------------------------------------
jsPro is a set of object-based libraries that extend JavaScript with rich new
functionality. jsPro provides methods that extend the core classes (ie String,
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
In addition jsPro is developed to a high coding standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
A lot of the methods used in these libraries have been inspired by functions
already available in PHP and other programming languages.
The aim of the project is simply to make jsPro the benchmark for high quality,
object-based functionality in JavaScript.
All improvements, suggestions, new methods and bug reports are welcome.
The following is a list of what has been implemented so far:
";
}
#this subroutine inserts a standard footer
sub FOOTER {
my $localTime = localtime();
print
"
This file was generated automatically: $localTime\n
";
}
#this subroutine displays help on the script
sub HELP {
die
"Usage: jsDoc [OPTION]
Example: jsDoc -r\n
-r, --readme generate README file for all JavaScript files in current
directory\n";
}
|
|
From: <wi...@us...> - 2003-10-01 14:42:10
|
Update of /cvsroot/jspro/jsPro/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv28592/scripts Log Message: Directory /cvsroot/jspro/jsPro/scripts added to the repository |
|
From: <wi...@us...> - 2003-10-01 10:02:20
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv1036
Modified Files:
README date.js CHANGES
Log Message:
Added a couple of new Date functions that gets the number of methods up to 150 and makes a good excuse to do a release
Index: README
===================================================================
RCS file: /cvsroot/jspro/jsPro/README,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** README 24 Sep 2003 13:10:23 -0000 1.24
--- README 1 Oct 2003 10:02:13 -0000 1.25
***************
*** 10,14 ****
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
! In addition jsPro is developed to very high standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
--- 10,14 ----
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
! In addition jsPro is developed to a high coding standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
***************
*** 63,91 ****
24. Date.prototype.getDayOfYear(): day of year
25. Date.prototype.getDaysInMonth(): days in month
! 26. Date.prototype.getGMTOffset(): GMT offset
! 27. Date.prototype.getLong12Hours(): 12-hour two-digit hour (01-12)
! 28. Date.prototype.getLong24Hours(): 24-hour two-digit hour (00-23)
! 29. Date.prototype.getLongDate(): two-digit day of month (01-31)
! 30. Date.prototype.getLongDayName(): day name
! 31. Date.prototype.getLongMinutes(): two-digit minutes (00-59)
! 32. Date.prototype.getLongMonth(): two-digit month (01-12)
! 33. Date.prototype.getLongMonthName(): month name
! 34. Date.prototype.getLongSeconds(): two-digit seconds (00-59)
! 35. Date.prototype.getMeridiem(): meridiem
! 36. Date.prototype.getOrdinalSuffix(): English ordinal suffix
! 37. Date.prototype.getRFC822Date(): RFC 822 date
! 38. Date.prototype.getShort12Hours(): 12-hour one-/two-digit hour (1-12)
! 39. Date.prototype.getShort24Hours(): 24-hour one-/two-digit hour (0-23)
! 40. Date.prototype.getShortDayName(): short day name
! 41. Date.prototype.getShortMonth(): one-/two-digit month (1-12)
! 42. Date.prototype.getShortMonthName(): short month name
! 43. Date.prototype.getShortYear(): two-digit year (00-99)
! 44. Date.prototype.getSwatchTime(): Swatch Internet Time
! 45. Date.prototype.getTimeSeconds(): seconds since UNIX epoch
! 46. Date.prototype.getTimezone(): not implemented
! 47. Date.prototype.getTimezoneOffsetSeconds(): timezone offset in seconds
! 48. Date.prototype.getWeekOfYear(): week of year
! 49. Date.prototype.isDaylightSavingsTime(): not implemented
! 50. Date.prototype.isLeapYear(): is leap year?
elements.js
--- 63,97 ----
24. Date.prototype.getDayOfYear(): day of year
25. Date.prototype.getDaysInMonth(): days in month
! 26. Date.prototype.getDaysInYear(): days in year
! 27. Date.prototype.getEasterDay(): easter day
! 28. Date.prototype.getEasterMonth(): easter month
! 29. Date.prototype.getGMTOffset(): GMT offset
! 30. Date.prototype.getLong12Hours(): 12-hour two-digit hour (01-12)
! 31. Date.prototype.getLong24Hours(): 24-hour two-digit hour (00-23)
! 32. Date.prototype.getLongDate(): two-digit day of month (01-31)
! 33. Date.prototype.getLongDayName(): day name
! 34. Date.prototype.getLongMinutes(): two-digit minutes (00-59)
! 35. Date.prototype.getLongMonth(): two-digit month (01-12)
! 36. Date.prototype.getLongMonthName(): month name
! 37. Date.prototype.getLongSeconds(): two-digit seconds (00-59)
! 38. Date.prototype.getMeridiem(): meridiem
! 39. Date.prototype.getOrdinalSuffix(): English ordinal suffix
! 40. Date.prototype.getRFC822Date(): RFC 822 date
! 41. Date.prototype.getShort12Hours(): 12-hour one-/two-digit hour (1-12)
! 42. Date.prototype.getShort24Hours(): 24-hour one-/two-digit hour (0-23)
! 43. Date.prototype.getShortDayName(): short day name
! 44. Date.prototype.getShortMonth(): one-/two-digit month (1-12)
! 45. Date.prototype.getShortMonthName(): short month name
! 46. Date.prototype.getShortYear(): two-digit year (00-99)
! 47. Date.prototype.getSwatchTime(): Swatch Internet Time
! 48. Date.prototype.getTimeSeconds(): seconds since UNIX epoch
! 49. Date.prototype.getTimezone(): not implemented
! 50. Date.prototype.getTimezoneOffsetSeconds(): timezone offset in seconds
! 51. Date.prototype.getWeekOfYear(): week of year
! 52. Date.prototype.getZodiacSign(): zodiac sign
! 53. Date.prototype.isDaylightSavingsTime(): not implemented
! 54. Date.prototype.isLeapYear(): is leap year?
! 55. Date.prototype.isWeekday(): is weekday?
! 56. Date.prototype.isWeekend(): is weekend?
elements.js
***************
*** 94,206 ****
error.js
-------------------------------------------------------------------------------
! 51. Error.prototype.handleError(): handles thrown exceptions
math.js
-------------------------------------------------------------------------------
! 52. Math.acosh(): inverse hyperbolic cosine
! 53. Math.acot(): inverse cotangent
! 54. Math.acoth(): inverse hyperbolic cotangent
! 55. Math.acsc(): inverse cosecant
! 56. Math.acsch(): inverse hyperbolic cosecant
! 57. Math.approx(): approximately equal
! 58. Math.arg(): polar angle (argument)
! 59. Math.asec(): inverse secant
! 60. Math.asech(): inverse hyperbolic secant
! 61. Math.asinh(): inverse hyperbolic sine
! 62. Math.atanh(): inverse hyperbolic tangent
! 63. Math.baseConvert(): convert base
! 64. Math.bin2dec(): binary to decimal conversion
! 65. Math.bin2hex(): binary to hexadecimal conversion
! 66. Math.bin2oct(): binary to octal conversion
! 67. Math.cosh(): hyperbolic cosine
! 68. Math.cot(): cotangent
! 69. Math.coth(): hyperbolic cotangent
! 70. Math.cov(): coversine
! 71. Math.csc(): cosecant
! 72. Math.csch(): hyperbolic cosecant
! 73. Math.dec2bin(): decimal to binary conversion
! 74. Math.dec2hex(): decimal to hexadecimal conversion
! 75. Math.dec2oct(): decimal to octal conversion
! 76. Math.deg2grad(): degree to gradian conversion
! 77. Math.deg2rad(): degree to radian conversion
! 78. Math.exp10(): exponent of 10
! 79. Math.expm1(): exp(x) - 1
! 80. Math.exsec(): exsecant
! 81. Math.fibonacci(): Fibonacci sequence
! 82. Math.fmod(): floating-point remainder
! 83. Math.gd(): Gudermannian function
! 84. Math.grad2deg(): gradian to degree conversion
! 85. Math.grad2rad(): gradian to radian conversion
! 86. Math.hav(): haversine
! 87. Math.hex2bin(): hexadecimal to binary conversion
! 88. Math.hex2dec(): hexadecimal to decimal conversion
! 89. Math.hex2oct(): hexadecimal to octal conversion
! 90. Math.hypot(): hypotenuse
! 91. Math.isEven(): is even?
! 92. Math.isOdd(): is odd?
! 93. Math.isPrime(): is prime?
! 94. Math.log10(): base-10 logarithm
! 95. Math.log2(): base-2 logarithm
! 96. Math.log1p(): log(1 + x)
! 97. Math.luhn(): LUHN formula
! 98. Math.oct2bin(): octal to binary conversion
! 99. Math.oct2dec(): octal to decimal conversion
! 100. Math.oct2hex(): octal to hexadecimal conversion
! 101. Math.pi(): calculate pi
! 102. Math.rad2deg(): radian to degree conversion
! 103. Math.rad2grad(): radian to gradian conversion
! 104. Math.sec(): secant
! 105. Math.sech(): hyperbolic secant
! 106. Math.sigmoid(): sigmoid function
! 107. Math.sign(): sign
! 108. Math.sinc(): sinc function
! 109. Math.sinh(): hyperbolic sine
! 110. Math.sq(): square
! 111. Math.tanc(): tanc function
! 112. Math.tanh(): hyperbolic tangent
! 113. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 114. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 115. String.prototype.addSlashes(): escape certain characters with backslashes
! 116. String.prototype.cat(): concatenate
! 117. String.prototype.compress(): compress whitespace to single spaces
! 118. String.prototype.count(): count occurrence of characters
! 119. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 120. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 121. String.prototype.insert(): insert one string into another
! 122. String.prototype.isEmailAddress(): is email address?
! 123. String.prototype.levenshtein(): Levenshtein distance
! 124. String.prototype.lpad(): pad left side
! 125. String.prototype.ltrim(): trim left side
! 126. String.prototype.nl2br(): newline to <br> conversion
! 127. String.prototype.overlay(): overlay one string over another
! 128. String.prototype.pad(): pad
! 129. String.prototype.remove(): remove characters
! 130. String.prototype.repeat(): repeat
! 131. String.prototype.repeatChars(): repeat characters
! 132. String.prototype.reverse(): reverse
! 133. String.prototype.rot13(): rotate 13 encoding
! 134. String.prototype.rpad(): pad right side
! 135. String.prototype.rtrim(): trim right side
! 136. String.prototype.swap(): swap characters
! 137. String.prototype.trim(): trim
! 138. String.prototype.truncate(): truncate
! 139. String.prototype.ucFirst(): uppercase first character
! 140. String.prototype.ucWords(): uppercase words
! 141. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 142. Validator.prototype.isBlankString(): is blank string?
! 143. Validator.prototype.isDigit(): is single digit?
! 144. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Wed Sep 24 14:11:37 2003
--- 100,212 ----
error.js
-------------------------------------------------------------------------------
! 57. Error.prototype.handleError(): handles thrown exceptions
math.js
-------------------------------------------------------------------------------
! 58. Math.acosh(): inverse hyperbolic cosine
! 59. Math.acot(): inverse cotangent
! 60. Math.acoth(): inverse hyperbolic cotangent
! 61. Math.acsc(): inverse cosecant
! 62. Math.acsch(): inverse hyperbolic cosecant
! 63. Math.approx(): approximately equal
! 64. Math.arg(): polar angle (argument)
! 65. Math.asec(): inverse secant
! 66. Math.asech(): inverse hyperbolic secant
! 67. Math.asinh(): inverse hyperbolic sine
! 68. Math.atanh(): inverse hyperbolic tangent
! 69. Math.baseConvert(): convert base
! 70. Math.bin2dec(): binary to decimal conversion
! 71. Math.bin2hex(): binary to hexadecimal conversion
! 72. Math.bin2oct(): binary to octal conversion
! 73. Math.cosh(): hyperbolic cosine
! 74. Math.cot(): cotangent
! 75. Math.coth(): hyperbolic cotangent
! 76. Math.cov(): coversine
! 77. Math.csc(): cosecant
! 78. Math.csch(): hyperbolic cosecant
! 79. Math.dec2bin(): decimal to binary conversion
! 80. Math.dec2hex(): decimal to hexadecimal conversion
! 81. Math.dec2oct(): decimal to octal conversion
! 82. Math.deg2grad(): degree to gradian conversion
! 83. Math.deg2rad(): degree to radian conversion
! 84. Math.exp10(): exponent of 10
! 85. Math.expm1(): exp(x) - 1
! 86. Math.exsec(): exsecant
! 87. Math.fibonacci(): Fibonacci sequence
! 88. Math.fmod(): floating-point remainder
! 89. Math.gd(): Gudermannian function
! 90. Math.grad2deg(): gradian to degree conversion
! 91. Math.grad2rad(): gradian to radian conversion
! 92. Math.hav(): haversine
! 93. Math.hex2bin(): hexadecimal to binary conversion
! 94. Math.hex2dec(): hexadecimal to decimal conversion
! 95. Math.hex2oct(): hexadecimal to octal conversion
! 96. Math.hypot(): hypotenuse
! 97. Math.isEven(): is even?
! 98. Math.isOdd(): is odd?
! 99. Math.isPrime(): is prime?
! 100. Math.log10(): base-10 logarithm
! 101. Math.log2(): base-2 logarithm
! 102. Math.log1p(): log(1 + x)
! 103. Math.luhn(): LUHN formula
! 104. Math.oct2bin(): octal to binary conversion
! 105. Math.oct2dec(): octal to decimal conversion
! 106. Math.oct2hex(): octal to hexadecimal conversion
! 107. Math.pi(): calculate pi
! 108. Math.rad2deg(): radian to degree conversion
! 109. Math.rad2grad(): radian to gradian conversion
! 110. Math.sec(): secant
! 111. Math.sech(): hyperbolic secant
! 112. Math.sigmoid(): sigmoid function
! 113. Math.sign(): sign
! 114. Math.sinc(): sinc function
! 115. Math.sinh(): hyperbolic sine
! 116. Math.sq(): square
! 117. Math.tanc(): tanc function
! 118. Math.tanh(): hyperbolic tangent
! 119. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 120. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 121. String.prototype.addSlashes(): escape certain characters with backslashes
! 122. String.prototype.cat(): concatenate
! 123. String.prototype.compress(): compress whitespace to single spaces
! 124. String.prototype.count(): count occurrence of characters
! 125. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 126. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 127. String.prototype.insert(): insert one string into another
! 128. String.prototype.isEmailAddress(): is email address?
! 129. String.prototype.levenshtein(): Levenshtein distance
! 130. String.prototype.lpad(): pad left side
! 131. String.prototype.ltrim(): trim left side
! 132. String.prototype.nl2br(): newline to <br> conversion
! 133. String.prototype.overlay(): overlay one string over another
! 134. String.prototype.pad(): pad
! 135. String.prototype.remove(): remove characters
! 136. String.prototype.repeat(): repeat
! 137. String.prototype.repeatChars(): repeat characters
! 138. String.prototype.reverse(): reverse
! 139. String.prototype.rot13(): rotate 13 encoding
! 140. String.prototype.rpad(): pad right side
! 141. String.prototype.rtrim(): trim right side
! 142. String.prototype.swap(): swap characters
! 143. String.prototype.trim(): trim
! 144. String.prototype.truncate(): truncate
! 145. String.prototype.ucFirst(): uppercase first character
! 146. String.prototype.ucWords(): uppercase words
! 147. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 148. Validator.prototype.isBlankString(): is blank string?
! 149. Validator.prototype.isDigit(): is single digit?
! 150. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Wed Oct 1 11:03:32 2003
Index: date.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/date.js,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** date.js 14 Sep 2003 09:37:52 -0000 1.7
--- date.js 1 Oct 2003 10:02:14 -0000 1.8
***************
*** 478,481 ****
--- 478,638 ----
/**
+ * Returns the number of days in the year for this date as either 365 or 366.
+ *
+ * @summary days in year
+ * @author Stuart Wigley
+ * @version 1.0, 12/01/03
+ * @interface <code>Date.getDaysInYear()</code>
+ * @requires <code>Date.isLeapYear()</code>
+ * @return the number of days in the year for this date as either
+ * 365 or 366
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws MethodNotAvailableException
+ * @throws UnknownException
+ * @see <code>Date.isLeapYear()</code>
+ */
+ Date.prototype.getDaysInYear = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (!('isLeapYear' in this)) {
+ throw vError = new MethodNotAvailableException('Date.getDaysInYear', 'Date.isLeapYear');
+ }
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getDaysInYear', 0, iNumArguments);
+ }
+
+ var sIsLeapYear = this.isLeapYear();
+
+ if (!sIsLeapYear) {
+ throw vError = new UnknownException('Date.getDaysInYear');
+ }
+
+ var sDaysInYear = (sIsLeapYear == '1') ? '366' : '365';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sDaysInYear;
+ }
+ }
+
+
+ /**
+ * Calculates the day on which Easter Sunday falls for the current year using
+ * Butcher's Method. Returns an integer between '1' and '31'
+ *
+ * @summary easter day
+ * @author Stuart Wigley
+ * @version 1.0, 12/01/03
+ * @interface <code>Date.getEasterDay()</code>
+ * @return the day on which Easter Sunday falls
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ */
+ Date.prototype.getEasterDay = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getEasterDate', 0, iNumArguments);
+ }
+
+ var iYear = this.getFullYear();
+ var a = iYear % 19;
+ var b = Math.floor(iYear / 100);
+ var c = iYear % 100;
+ var d = Math.floor(b / 4);
+ var e = b % 4;
+ var f = Math.floor((b + 8) / 25);
+ var g = Math.floor((b - f + 1) / 3);
+ var h = (19 * a + b - d - g + 15) % 30;
+ var i = Math.floor(c / 4);
+ var k = c % 4;
+ var l = (32 + 2 * e + 2 * i - h - k) % 7;
+ var m = Math.floor((a + 11 * h + 22 * l) / 451);
+ var p = (h + l - 7 * m + 114) % 31;
+ var iEasterDay = p + 1;
+
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : iEasterDay;
+ }
+ }
+
+
+ /**
+ * Calculates the month in which Easter Sunday falls for the current year using
+ * Butcher's Method. Returns '3' for March or '4' for April.
+ *
+ * @summary easter month
+ * @author Stuart Wigley
+ * @version 1.0, 12/01/03
+ * @interface <code>Date.getEasterMonth()</code>
+ * @return the month in which Easter Sunday falls
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ */
+ Date.prototype.getEasterMonth = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getEasterMonth', 0, iNumArguments);
+ }
+
+ var iYear = this.getFullYear();
+ var a = iYear % 19;
+ var b = Math.floor(iYear / 100);
+ var c = iYear % 100;
+ var d = Math.floor(b / 4);
+ var e = b % 4;
+ var f = Math.floor((b + 8) / 25);
+ var g = Math.floor((b - f + 1) / 3);
+ var h = (19 * a + b - d - g + 15) % 30;
+ var i = Math.floor(c / 4);
+ var k = c % 4;
+ var l = (32 + 2 * e + 2 * i - h - k) % 7;
+ var m = Math.floor((a + 11 * h + 22 * l) / 451);
+ var iEasterMonth = Math.floor((h + l - 7 * m + 114) / 31);
+
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : iEasterMonth;
+ }
+ }
+
+
+ /**
* Returns the formatted Greenwich Mean Time (GMT) offset ('[+/-]HHMM') for
* this date that consists of a plus sign (+) or minus sign (-) followed by
***************
*** 1554,1557 ****
--- 1711,1779 ----
/**
+ * Returns Zodiac sign for the current date.
+ *
+ * @summary zodiac sign
+ * @author Stuart Wigley
+ * @version 1.0, 10/01/03
+ * @interface <code>Date.getZodiacSign()</code>
+ * @return the Zodiac sign for the current date
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ */
+ Date.prototype.getZodiacSign = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getZodiac', 0, iNumArguments);
+ }
+
+ var iMonth = this.getMonth() + 1;
+ var iDay = this.getDate();
+ var sZodiacSign = '';
+
+ if (iMonth == 1 && iDay >= 20 || iMonth == 2 && iDay <=18) {
+ sZodiacSign = "Aquarius";
+ } else if (iMonth == 2 && iDay >=19 || iMonth == 3 && iDay <=20) {
+ sZodiacSign = "Pisces";
+ } else if (iMonth == 3 && iDay >=21 || iMonth == 4 && iDay <=19) {
+ sZodiacSign = "Aries";
+ } else if (iMonth == 4 && iDay >=20 || iMonth == 5 && iDay <=20) {
+ sZodiacSign = "Taurus";
+ } else if (iMonth == 5 && iDay >=21 || iMonth == 6 && iDay <=21) {
+ sZodiacSign = "Gemini";
+ } else if (iMonth == 6 && iDay >=22 || iMonth == 7 && iDay <=22) {
+ sZodiacSign = "Cancer";
+ } else if (iMonth == 7 && iDay >=23 || iMonth == 8 && iDay <=22) {
+ sZodiacSign = "Leo";
+ } else if (iMonth == 8 && iDay >=23 || iMonth == 9 && iDay <=22) {
+ sZodiacSign = "Virgo";
+ } else if (iMonth == 9 && iDay >=23 || iMonth == 10 && iDay <=22) {
+ sZodiacSign = "Libra";
+ } else if (iMonth == 10 && iDay >=23 || iMonth == 11 && iDay <=21) {
+ sZodiacSign = "Scorpio";
+ } else if (iMonth == 11 && iDay >=22 || iMonth == 12 && iDay <=21) {
+ sZodiacSign = "Sagittarius";
+ } else if (iMonth == 12 && iDay >=22 || iMonth == 1 && iDay <=19) {
+ sZodiacSign = "Capricorn";
+ }
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sZodiacSign;
+ }
+ }
+
+
+ /**
* Determines if this date falls within Daylight Savings Time.
*
***************
*** 1608,1611 ****
--- 1830,1911 ----
return vError ? null : sIsLeapYear;
+ }
+ }
+
+
+ /**
+ * Determines if the current day is a weekday in the range Monday to Friday.
+ *
+ * @summary is weekday?
+ * @author Stuart Wigley
+ * @version 1.0, 10/01/03
+ * @interface <code>Date.isWeekday()</code>
+ * @return '1' if the day is a weekday
+ * @return '0' if the day is not a weekday
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ */
+ Date.prototype.isWeekday = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.isWeekday', 0, iNumArguments);
+ }
+
+ var iDayOfWeek = this.getDay();
+ var sIsWeekDay = (iDayOfWeek > 0 && iDayOfWeek < 6) ? '1' : '0';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sIsWeekDay;
+ }
+ }
+
+
+ /**
+ * Determines if the current day is a weekend ie Saturday or Sunday
+ *
+ * @summary is weekend?
+ * @author Stuart Wigley
+ * @version 1.0, 10/01/03
+ * @interface <code>Date.isWeekend()</code>
+ * @return '1' if the day is a weekend
+ * @return '0' if the day is not a weekend
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ */
+ Date.prototype.isWeekend = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.isWeekend', 0, iNumArguments);
+ }
+
+ var iDayOfWeek = this.getDay();
+ var sIsWeekEnd = (iDayOfWeek == 0 || iDayOfWeek == 6) ? '1' : '0';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sIsWeekEnd;
}
}
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** CHANGES 24 Sep 2003 13:10:23 -0000 1.19
--- CHANGES 1 Oct 2003 10:02:14 -0000 1.20
***************
*** 1,4 ****
===============================================================================
! Whats new in R3? (Not Yet Released)
===============================================================================
--- 1,4 ----
===============================================================================
! Whats new in R3? (01 Oct 2003)
===============================================================================
***************
*** 25,28 ****
--- 25,37 ----
- Constants.PIFORMULA_HUTTON
- Constants.PIFORMULA_MACHIN
+
+ date.js:
+
+ - Date.getDaysInYear()
+ - Date.getEasterDay()
+ - Date.getEasterMonth()
+ - Date.getZodiacSign()
+ - Date.isWeekday()
+ - Date.isWeekend()
debug/debug.js:
|
|
From: <wi...@us...> - 2003-10-01 10:02:19
|
Update of /cvsroot/jspro/jsPro/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv1036/docs
Modified Files:
date.html
Log Message:
Added a couple of new Date functions that gets the number of methods up to 150 and makes a good excuse to do a release
Index: date.html
===================================================================
RCS file: /cvsroot/jspro/jsPro/docs/date.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** date.html 14 Sep 2003 08:11:04 -0000 1.4
--- date.html 1 Oct 2003 10:02:15 -0000 1.5
***************
*** 60,63 ****
--- 60,81 ----
</tr>
<tr>
+ <td>Date.getDaysInYear()</td>
+ <td> </td>
+ <td><input id="getDaysInYear" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="getDaysInYearResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Date.getEasterDay()</td>
+ <td> </td>
+ <td><input id="getEasterDay" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="getEasterDayResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Date.getEasterMonth()</td>
+ <td> </td>
+ <td><input id="getEasterMonth" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="getEasterMonthResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Date.getGMTOffset()</td>
<td> </td>
***************
*** 198,201 ****
--- 216,225 ----
</tr>
<tr>
+ <td>Date.getZodiacSign()</td>
+ <td> </td>
+ <td><input id="getZodiacSign" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="getZodiacSignResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Date.isDaylightSavingsTime()</td>
<td> </td>
***************
*** 208,211 ****
--- 232,247 ----
<td><input id="isLeapYear" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
<td><input id="isLeapYearResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Date.isWeekday()</td>
+ <td> </td>
+ <td><input id="isWeekday" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="isWeekdayResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Date.isWeekend()</td>
+ <td> </td>
+ <td><input id="isWeekend" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'oDate')" /></td>
+ <td><input id="isWeekendResult" name="output" type="text" size="30" readonly="readonly" /></td>
</tr>
</tbody>
|
|
From: <gat...@us...> - 2003-09-25 05:04:35
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv20728
Modified Files:
string.js
Log Message:
QA: String.cat() for consistency, new error type, and somewhat different logic due to the circumstances in which the document type variable effects the way in which error cases must be tested; this method can now reuse the jsProConstants.DOCTYPE_????? constants, and the updated comments for this method support this reuse
Index: string.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/string.js,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** string.js 23 Sep 2003 14:48:15 -0000 1.22
--- string.js 25 Sep 2003 05:03:01 -0000 1.23
***************
*** 74,89 ****
/**
* Concatenate the string representation of the specified value to the end of
! * this string. If <code>iNewLine</code> is specified insert a newline
! * character between the two strings.
*
* @summary concatenate
* @author Stuart Wigley
* @author Randolph Fielding
! * @version 1.2, 09/23/03
* @interface <code>String.cat(vValue)</code>
! * @interface <code>String.cat(vValue, iNewLine)</code>
* @param vValue the value to be concatenated to the end of this string
! * @param iNewLine an integer representing the newline character to be
! * used. (HTML: 0; XHTML: 1; WINDOWS: 2; UNIX: 3; MAC: 4)
* (optional)
* @return a concatenated string
--- 74,92 ----
/**
* Concatenate the string representation of the specified value to the end of
! * this string. An end-of-line terminator specific to a certain document type
! * will be inserted between the string and the specified value if a document
! * type is specified.
*
* @summary concatenate
* @author Stuart Wigley
* @author Randolph Fielding
! * @version 1.3, 09/25/03
* @interface <code>String.cat(vValue)</code>
! * @interface <code>String.cat(vValue, iDocType)</code>
* @param vValue the value to be concatenated to the end of this string
! * @param iDocType an integer representing the document type that the
! * end-of-line terminator between the string and
! * <code>vValue</code> conforms to (HTML: 0; XHTML: 1;
! * Windows text: 2; UNIX text: 3; Macintosh text: 4)
* (optional)
* @return a concatenated string
***************
*** 91,95 ****
* @throws IllegalArgumentException
*/
! String.prototype.cat = function() {
try {
--- 94,98 ----
* @throws IllegalArgumentException
*/
! String.prototype.cat = function(vValue) {
try {
***************
*** 97,128 ****
var vError = null;
var iNumArguments = arguments.length;
! var vValue = '';
! var iNewLine = -1;
! if (iNumArguments == 1) {
! vValue = arguments[0];
! } else if (iNumArguments == 2) {
! vValue = arguments[0];
! iNewLine = arguments[1];
! } else {
throw vError = new IllegalArgumentException('String.cat', '1 or 2', iNumArguments);
}
! if ((typeof iNewLine != 'number') || (iNewLine.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.cat', 'integer', typeof iNewLine);
! }
!
! var sNewLine = '';
! switch (iNewLine) {
! case 0 : sNewLine = '<BR>'; break;
! case 1 : sNewLine = '<br />'; break;
! case 2 : sNewLine = '\r\n'; break;
! case 3 : sNewLine = '\n'; break;
! case 4 : sNewLine = '\r'; break;
! default : break;
}
! var sCatString = this + sNewLine + vValue.toString();
}
catch (vError) {
--- 100,130 ----
var vError = null;
var iNumArguments = arguments.length;
! var iDocType = null;
! if ((iNumArguments < 1) || (iNumArguments > 2)) {
throw vError = new IllegalArgumentException('String.cat', '1 or 2', iNumArguments);
+ } else if (iNumArguments == 2) {
+ iDocType = arguments[1];
}
! var sEolTerminator = '';
! if (iDocType) {
! if ((typeof iDocType != 'number') || (iDocType.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.cat', 'integer', typeof iDocType);
! }
! if ((iDocType != 0) && (iDocType != 1) && (iDocType != 2) && (iDocType != 3) && (iDocType != 4)) {
! throw vError = new IllegalValueException('String.cat', 'iDocType', '0, 1, 2, 3 or 4', iDocType);
! }
! switch (iDocType) {
! case 0 : sEolTerminator = '<BR>'; break;
! case 1 : sEolTerminator = '<br />'; break;
! case 2 : sEolTerminator = '\r\n'; break;
! case 3 : sEolTerminator = '\n'; break;
! case 4 : sEolTerminator = '\r'; break;
! }
}
! var sCatString = this + sEolTerminator + vValue.toString();
}
catch (vError) {
|
|
From: <wi...@us...> - 2003-09-24 13:10:29
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv13382
Modified Files:
README math.js CHANGES
Log Message:
new methods: Math.approx(), Math.arg(), Math.exp10
Index: README
===================================================================
RCS file: /cvsroot/jspro/jsPro/README,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** README 19 Sep 2003 15:47:00 -0000 1.23
--- README 24 Sep 2003 13:10:23 -0000 1.24
***************
*** 103,203 ****
55. Math.acsc(): inverse cosecant
56. Math.acsch(): inverse hyperbolic cosecant
! 57. Math.asec(): inverse secant
! 58. Math.asech(): inverse hyperbolic secant
! 59. Math.asinh(): inverse hyperbolic sine
! 60. Math.atanh(): inverse hyperbolic tangent
! 61. Math.baseConvert(): convert base
! 62. Math.bin2dec(): binary to decimal conversion
! 63. Math.bin2hex(): binary to hexadecimal conversion
! 64. Math.bin2oct(): binary to octal conversion
! 65. Math.cosh(): hyperbolic cosine
! 66. Math.cot(): cotangent
! 67. Math.coth(): hyperbolic cotangent
! 68. Math.cov(): coversine
! 69. Math.csc(): cosecant
! 70. Math.csch(): hyperbolic cosecant
! 71. Math.dec2bin(): decimal to binary conversion
! 72. Math.dec2hex(): decimal to hexadecimal conversion
! 73. Math.dec2oct(): decimal to octal conversion
! 74. Math.deg2grad(): degree to gradian conversion
! 75. Math.deg2rad(): degree to radian conversion
! 76. Math.expm1(): exp(x) - 1
! 77. Math.exsec(): exsecant
! 78. Math.fibonacci(): Fibonacci sequence
! 79. Math.fmod(): floating-point remainder
! 80. Math.gd(): Gudermannian function
! 81. Math.grad2deg(): gradian to degree conversion
! 82. Math.grad2rad(): gradian to radian conversion
! 83. Math.hav(): haversine
! 84. Math.hex2bin(): hexadecimal to binary conversion
! 85. Math.hex2dec(): hexadecimal to decimal conversion
! 86. Math.hex2oct(): hexadecimal to octal conversion
! 87. Math.hypot(): hypotenuse
! 88. Math.isEven(): is even?
! 89. Math.isOdd(): is odd?
! 90. Math.isPrime(): is prime?
! 91. Math.log10(): base-10 logarithm
! 92. Math.log2(): base-2 logarithm
! 93. Math.log1p(): log(1 + x)
! 94. Math.luhn(): LUHN formula
! 95. Math.oct2bin(): octal to binary conversion
! 96. Math.oct2dec(): octal to decimal conversion
! 97. Math.oct2hex(): octal to hexadecimal conversion
! 98. Math.pi(): calculate pi
! 99. Math.rad2deg(): radian to degree conversion
! 100. Math.rad2grad(): radian to gradian conversion
! 101. Math.sec(): secant
! 102. Math.sech(): hyperbolic secant
! 103. Math.sigmoid(): sigmoid function
! 104. Math.sign(): sign
! 105. Math.sinc(): sinc function
! 106. Math.sinh(): hyperbolic sine
! 107. Math.sq(): square
! 108. Math.tanc(): tanc function
! 109. Math.tanh(): hyperbolic tangent
! 110. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 111. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 112. String.prototype.addSlashes(): escape certain characters with backslashes
! 113. String.prototype.cat(): concatenate
! 114. String.prototype.compress(): compress to spaces
! 115. String.prototype.count(): count occurrence of characters
! 116. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 117. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 118. String.prototype.insert(): insert a string
! 119. String.prototype.isEmailAddress(): is email address?
! 120. String.prototype.levenshtein(): Levenshtein distance
! 121. String.prototype.lpad(): pad left side
! 122. String.prototype.ltrim(): trim left side
! 123. String.prototype.nl2br(): newline to <br> conversion
! 124. String.prototype.overlay(): overlay a string
! 125. String.prototype.pad(): pad
! 126. String.prototype.remove(): delete characters
! 127. String.prototype.repeat(): repeat
! 128. String.prototype.repeatChars(): repeat characters
! 129. String.prototype.reverse(): reverse
! 130. String.prototype.rot13(): rotate 13 encoding
! 131. String.prototype.rpad(): pad right side
! 132. String.prototype.rtrim(): trim right side
! 133. String.prototype.swap(): swap characters
! 134. String.prototype.trim(): trim
! 135. String.prototype.truncate(): truncate
! 136. String.prototype.ucFirst(): uppercase first character
! 137. String.prototype.ucWords(): uppercase words
! 138. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 139. Validator.prototype.isBlankString(): is a blank string
! 140. Validator.prototype.isDigit(): is a single digit
! 141. Validator.prototype.isInteger(): is an integer
! This file was generated automatically: Fri Sep 19 16:48:38 2003
--- 103,206 ----
55. Math.acsc(): inverse cosecant
56. Math.acsch(): inverse hyperbolic cosecant
! 57. Math.approx(): approximately equal
! 58. Math.arg(): polar angle (argument)
! 59. Math.asec(): inverse secant
! 60. Math.asech(): inverse hyperbolic secant
! 61. Math.asinh(): inverse hyperbolic sine
! 62. Math.atanh(): inverse hyperbolic tangent
! 63. Math.baseConvert(): convert base
! 64. Math.bin2dec(): binary to decimal conversion
! 65. Math.bin2hex(): binary to hexadecimal conversion
! 66. Math.bin2oct(): binary to octal conversion
! 67. Math.cosh(): hyperbolic cosine
! 68. Math.cot(): cotangent
! 69. Math.coth(): hyperbolic cotangent
! 70. Math.cov(): coversine
! 71. Math.csc(): cosecant
! 72. Math.csch(): hyperbolic cosecant
! 73. Math.dec2bin(): decimal to binary conversion
! 74. Math.dec2hex(): decimal to hexadecimal conversion
! 75. Math.dec2oct(): decimal to octal conversion
! 76. Math.deg2grad(): degree to gradian conversion
! 77. Math.deg2rad(): degree to radian conversion
! 78. Math.exp10(): exponent of 10
! 79. Math.expm1(): exp(x) - 1
! 80. Math.exsec(): exsecant
! 81. Math.fibonacci(): Fibonacci sequence
! 82. Math.fmod(): floating-point remainder
! 83. Math.gd(): Gudermannian function
! 84. Math.grad2deg(): gradian to degree conversion
! 85. Math.grad2rad(): gradian to radian conversion
! 86. Math.hav(): haversine
! 87. Math.hex2bin(): hexadecimal to binary conversion
! 88. Math.hex2dec(): hexadecimal to decimal conversion
! 89. Math.hex2oct(): hexadecimal to octal conversion
! 90. Math.hypot(): hypotenuse
! 91. Math.isEven(): is even?
! 92. Math.isOdd(): is odd?
! 93. Math.isPrime(): is prime?
! 94. Math.log10(): base-10 logarithm
! 95. Math.log2(): base-2 logarithm
! 96. Math.log1p(): log(1 + x)
! 97. Math.luhn(): LUHN formula
! 98. Math.oct2bin(): octal to binary conversion
! 99. Math.oct2dec(): octal to decimal conversion
! 100. Math.oct2hex(): octal to hexadecimal conversion
! 101. Math.pi(): calculate pi
! 102. Math.rad2deg(): radian to degree conversion
! 103. Math.rad2grad(): radian to gradian conversion
! 104. Math.sec(): secant
! 105. Math.sech(): hyperbolic secant
! 106. Math.sigmoid(): sigmoid function
! 107. Math.sign(): sign
! 108. Math.sinc(): sinc function
! 109. Math.sinh(): hyperbolic sine
! 110. Math.sq(): square
! 111. Math.tanc(): tanc function
! 112. Math.tanh(): hyperbolic tangent
! 113. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 114. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 115. String.prototype.addSlashes(): escape certain characters with backslashes
! 116. String.prototype.cat(): concatenate
! 117. String.prototype.compress(): compress whitespace to single spaces
! 118. String.prototype.count(): count occurrence of characters
! 119. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 120. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 121. String.prototype.insert(): insert one string into another
! 122. String.prototype.isEmailAddress(): is email address?
! 123. String.prototype.levenshtein(): Levenshtein distance
! 124. String.prototype.lpad(): pad left side
! 125. String.prototype.ltrim(): trim left side
! 126. String.prototype.nl2br(): newline to <br> conversion
! 127. String.prototype.overlay(): overlay one string over another
! 128. String.prototype.pad(): pad
! 129. String.prototype.remove(): remove characters
! 130. String.prototype.repeat(): repeat
! 131. String.prototype.repeatChars(): repeat characters
! 132. String.prototype.reverse(): reverse
! 133. String.prototype.rot13(): rotate 13 encoding
! 134. String.prototype.rpad(): pad right side
! 135. String.prototype.rtrim(): trim right side
! 136. String.prototype.swap(): swap characters
! 137. String.prototype.trim(): trim
! 138. String.prototype.truncate(): truncate
! 139. String.prototype.ucFirst(): uppercase first character
! 140. String.prototype.ucWords(): uppercase words
! 141. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 142. Validator.prototype.isBlankString(): is blank string?
! 143. Validator.prototype.isDigit(): is single digit?
! 144. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Wed Sep 24 14:11:37 2003
Index: math.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/math.js,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** math.js 22 Sep 2003 06:56:07 -0000 1.23
--- math.js 24 Sep 2003 13:10:23 -0000 1.24
***************
*** 257,260 ****
--- 257,378 ----
/**
+ * Calculates if two numbers are approximately equal. Approximation defaults
+ * to +/- 0.01 but can be optionally set using the <code>fEpsilon</code>
+ * argument
+ *
+ * @summary approximately equal
+ * @author Stuart Wigley
+ * @version 1.0, 09/24/03
+ * @interface <code>Math.approx(fX, fY)</code>
+ * @interface <code>Math.approx(fX, fY, fEpsilon)</code>
+ * @param fX a floating-point number
+ * @param fY a floating-point number
+ * @param fEpsilon accuracy of approximation (optional)
+ * @return true if <code>fX</code> and <code>fY</code> are
+ * approximately equal; false otherwise
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.approx = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+ var fX, fY;
+ var fEpsilon = 0.01;
+
+ if (iNumArguments == 2) {
+ fX = arguments[0];
+ fY = arguments[1];
+ } else if (iNumArguments == 3) {
+ fX = arguments[0];
+ fY = arguments[1];
+ fEpsilon = arguments[2];
+ } else {
+ throw vError = new IllegalArgumentException('Math.approx', '2 or 3', iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.approx', 'number', typeof fX);
+ }
+ if (typeof fY != 'number') {
+ throw vError = new TypeMismatchException('Math.approx', 'number', typeof fY);
+ }
+ if (typeof fEpsilon != 'number') {
+ throw vError = new TypeMismatchException('Math.approx', 'number', typeof fEpsilon);
+ }
+
+ var bApprox = (Math.abs(fX - fY) < fEpsilon) ? true : false;
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : bApprox;
+ }
+ }
+
+
+ /**
+ * Calculates the polar angle (argument) of a pair of rectangular coordinates.
+ *
+ * @summary polar angle (argument)
+ * @author Stuart Wigley
+ * @version 1.0, 09/24/03
+ * @interface <code>Math.arg(fX, fY)</code>
+ * @requires <code>math.sign()</code>
+ * @param fX a floating-point number
+ * @param fY a floating-point number
+ * @return the polar angle (argument)
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ * @throws MethodNotAvailableException
+ * @see <code>math.sign()</code>
+ */
+ Math.arg = function(fX, fY) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (!('sign' in this)) {
+ throw vError = new MethodNotAvailableException('Math.arg', 'Math.sign');
+ }
+
+ if (iNumArguments != 2) {
+ throw vError = new IllegalArgumentException('Math.arg', 2, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.arg', 'number', typeof fX);
+ }
+ if (typeof fY != 'number') {
+ throw vError = new TypeMismatchException('Math.arg', 'number', typeof fY);
+ }
+
+ var fArgument = Math.atan2(fY, fX) + (Math.PI / 2) * Math.sign(fY) * (1 - Math.sign(fX));
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fArgument;
+ }
+ }
+
+
+ /**
* Calculates and returns the inverse secant of a number in 2D Cartesian
* space.
***************
*** 1129,1132 ****
--- 1247,1293 ----
return vError ? null : fRadians;
+ }
+ }
+
+
+ /**
+ * Calculates the exponent of 10. ie 10 to the power of <code>fX</code>
+ *
+ * @summary exponent of 10
+ * @author Stuart Wigley
+ * @version 1.0, 09/24/03
+ * @interface <code>Math.exp10(fX)</code>
+ * @param fX a floating-point number
+ * @return 10 raised to the power of <code>fX</code>
+ * @return <code>null</code> if an exception is encountered
+ * @throws IllegalArgumentException
+ * @throws TypeMismatchException
+ */
+ Math.exp10 = function(fX) {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments != 1) {
+ throw vError = new IllegalArgumentException('Math.exp10', 1, iNumArguments);
+ }
+
+ if (typeof fX != 'number') {
+ throw vError = new TypeMismatchException('Math.exp10', 'number', typeof fX);
+ }
+
+ var fExponent10 = Math.pow(10, fX);
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : fExponent10;
}
}
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** CHANGES 22 Sep 2003 08:00:59 -0000 1.18
--- CHANGES 24 Sep 2003 13:10:23 -0000 1.19
***************
*** 39,43 ****
--- 39,46 ----
math.js:
+ - Math.approx()
+ - Math.arg()
- Math.baseConvert()
+ - Math.exp10()
- Math.fmod()
- Math.pi()
|
|
From: <wi...@us...> - 2003-09-24 13:10:29
|
Update of /cvsroot/jspro/jsPro/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv13382/docs
Modified Files:
math.html
Log Message:
new methods: Math.approx(), Math.arg(), Math.exp10
Index: math.html
===================================================================
RCS file: /cvsroot/jspro/jsPro/docs/math.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** math.html 14 Sep 2003 08:16:38 -0000 1.8
--- math.html 24 Sep 2003 13:10:23 -0000 1.9
***************
*** 71,74 ****
--- 71,93 ----
</tr>
<tr>
+ <td>Math.approx()</td>
+ <td>
+ <input id="approx1" name="input" type="text" size="5" />
+ <input id="approx2" name="input" type="text" size="5" />
+ <input id="approx3" name="input" type="text" size="5" />
+ </td>
+ <td><input id="approx" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="approxResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Math.arg()</td>
+ <td>
+ <input id="arg1" name="input" type="text" size="5" />
+ <input id="arg2" name="input" type="text" size="5" />
+ </td>
+ <td><input id="arg" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="argResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.asec()</td>
<td><input id="asec1" name="input" type="text" size="5" /></td>
***************
*** 189,192 ****
--- 208,217 ----
</tr>
<tr>
+ <td>Math.exp10()</td>
+ <td><input id="exp101" name="input" type="text" size="5" /></td>
+ <td><input id="exp10" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="exp10Result" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
<td>Math.expm1()</td>
<td><input id="expm11" name="input" type="text" size="5" /></td>
***************
*** 301,304 ****
--- 326,338 ----
<td><input id="log1p" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
<td><input id="log1pResult" name="output" type="text" size="30" readonly="readonly" /></td>
+ </tr>
+ <tr>
+ <td>Math.logn()</td>
+ <td>
+ <input id="logn1" name="input" type="text" size="5" />
+ <input id="logn2" name="input" type="text" size="5" />
+ </td>
+ <td><input id="logn" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, 'Math')" /></td>
+ <td><input id="lognResult" name="output" type="text" size="30" readonly="readonly" /></td>
</tr>
<tr>
|
|
From: <wi...@us...> - 2003-09-23 14:48:23
|
Update of /cvsroot/jspro/jsPro/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv28119/docs
Modified Files:
string.html
Log Message:
fixed up String.cat() to optionally include newline characters
Index: string.html
===================================================================
RCS file: /cvsroot/jspro/jsPro/docs/string.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** string.html 20 Sep 2003 20:29:56 -0000 1.5
--- string.html 23 Sep 2003 14:48:15 -0000 1.6
***************
*** 51,55 ****
<tr>
<td>String.cat()</td>
! <td><input id="cat1" name="input" type="text" size="5" /></td>
<td><input id="cat" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td>
<td><input id="catResult" name="output" type="text" size="30" readonly="readonly" /></td>
--- 51,58 ----
<tr>
<td>String.cat()</td>
! <td>
! <input id="cat1" name="input" type="text" size="5" />
! <input id="cat2" name="input" type="text" size="5" />
! </td>
<td><input id="cat" type="button" value="Calculate >" onclick="oTest.evaluateMethod(this, '\'' + document.getElementById('inputString').value + '\'')" /></td>
<td><input id="catResult" name="output" type="text" size="30" readonly="readonly" /></td>
|
|
From: <wi...@us...> - 2003-09-23 14:48:19
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv28119
Modified Files:
string.js
Log Message:
fixed up String.cat() to optionally include newline characters
Index: string.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/string.js,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** string.js 22 Sep 2003 06:28:47 -0000 1.21
--- string.js 23 Sep 2003 14:48:15 -0000 1.22
***************
*** 74,90 ****
/**
* Concatenate the string representation of the specified value to the end of
! * this string.
*
* @summary concatenate
* @author Stuart Wigley
* @author Randolph Fielding
! * @version 1.1, 09/20/03
* @interface <code>String.cat(vValue)</code>
* @param vValue the value to be concatenated to the end of this string
* @return a concatenated string
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
*/
! String.prototype.cat = function(vValue) {
try {
--- 74,95 ----
/**
* Concatenate the string representation of the specified value to the end of
! * this string. If <code>iNewLine</code> is specified insert a newline
! * character between the two strings.
*
* @summary concatenate
* @author Stuart Wigley
* @author Randolph Fielding
! * @version 1.2, 09/23/03
* @interface <code>String.cat(vValue)</code>
+ * @interface <code>String.cat(vValue, iNewLine)</code>
* @param vValue the value to be concatenated to the end of this string
+ * @param iNewLine an integer representing the newline character to be
+ * used. (HTML: 0; XHTML: 1; WINDOWS: 2; UNIX: 3; MAC: 4)
+ * (optional)
* @return a concatenated string
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
*/
! String.prototype.cat = function() {
try {
***************
*** 92,101 ****
var vError = null;
var iNumArguments = arguments.length;
! if (iNumArguments != 1) {
! throw vError = new IllegalArgumentException('String.cat', 1, iNumArguments);
}
! var sCatString = this + vValue.toString();
}
catch (vError) {
--- 97,128 ----
var vError = null;
var iNumArguments = arguments.length;
+ var vValue = '';
+ var iNewLine = -1;
! if (iNumArguments == 1) {
! vValue = arguments[0];
! } else if (iNumArguments == 2) {
! vValue = arguments[0];
! iNewLine = arguments[1];
! } else {
! throw vError = new IllegalArgumentException('String.cat', '1 or 2', iNumArguments);
}
! if ((typeof iNewLine != 'number') || (iNewLine.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.cat', 'integer', typeof iNewLine);
! }
!
! var sNewLine = '';
!
! switch (iNewLine) {
! case 0 : sNewLine = '<BR>'; break;
! case 1 : sNewLine = '<br />'; break;
! case 2 : sNewLine = '\r\n'; break;
! case 3 : sNewLine = '\n'; break;
! case 4 : sNewLine = '\r'; break;
! default : break;
! }
!
! var sCatString = this + sNewLine + vValue.toString();
}
catch (vError) {
|
|
From: <gat...@us...> - 2003-09-22 08:31:55
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv23464
Modified Files:
CHANGES
Log Message:
added IllegalValueException()
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** CHANGES 20 Sep 2003 20:18:08 -0000 1.17
--- CHANGES 22 Sep 2003 08:00:59 -0000 1.18
***************
*** 33,36 ****
--- 33,40 ----
defined debug messages or error messages
+ error.js:
+
+ - IllegalValueException()
+
math.js:
|
|
From: <gat...@us...> - 2003-09-22 06:56:11
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv12429
Modified Files:
math.js
Log Message:
updated certain TypeMismatchExceptions to test for and display the correct datatype ('integer' instead of 'number') and updated methods with new error IllegalValueException
Index: math.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/math.js,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** math.js 15 Sep 2003 01:53:22 -0000 1.22
--- math.js 22 Sep 2003 06:56:07 -0000 1.23
***************
*** 453,461 ****
* @param vNumber an integer, a floating-point number, or a string to
* convert from one base to another base
! * @param iBaseFrom the base to convert from
! * @param iBaseTo the base to convert to
* @return a string representation of the converted number
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
* @throws TypeMismatchException
*/
--- 453,463 ----
* @param vNumber an integer, a floating-point number, or a string to
* convert from one base to another base
! * @param iBaseFrom the base to convert from as an integer between 2 and
! * 36
! * @param iBaseTo the base to convert to as an integer between 2 and 36
* @return a string representation of the converted number
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 475,484 ****
}
! if ((typeof iBaseFrom != 'number') || (parseInt(iBaseFrom.toString()) != iBaseFrom)) {
! throw vError = new TypeMismatchException('Math.baseConvert', 'number', typeof iBaseFrom);
}
! if ((typeof iBaseTo != 'number') || (parseInt(iBaseTo.toString()) != iBaseTo)) {
! throw vError = new TypeMismatchException('Math.baseConvert', 'number', typeof iBaseTo);
}
--- 477,494 ----
}
! if ((typeof iBaseFrom != 'number') || (iBaseFrom.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.baseConvert', 'integer', typeof iBaseFrom);
}
! if ((iBaseFrom < 2) || (iBaseFrom > 36)) {
! throw vError = new IllegalValueException('Math.baseConvert', 'iBaseFrom', '2, 3, 4, ..., 35 or 36', iBaseFrom);
! }
!
! if ((typeof iBaseTo != 'number') || (iBaseTo.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.baseConvert', 'integer', typeof iBaseTo);
! }
!
! if ((iBaseTo < 2) || (iBaseTo > 36)) {
! throw vError = new IllegalValueException('Math.baseConvert', 'iBaseTo', '2, 3, 4, ..., 35 or 36', iBaseTo);
}
***************
*** 508,511 ****
--- 518,523 ----
* @param lBinaryNum a binary number
* @return the decimal equivalent of <code>lBinaryNum</code>
+ * @return <code>NaN</code> if <code>lBinaryNum</code> is not a
+ * binary number
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
***************
*** 523,528 ****
}
! if ((typeof lBinaryNum != 'number') || (parseInt(lBinaryNum.toString()) != lBinaryNum)) {
! throw vError = new TypeMismatchException('Math.bin2dec', 'number', typeof lBinaryNum);
}
--- 535,540 ----
}
! if ((typeof lBinaryNum != 'number') || (lBinaryNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.bin2dec', 'long', typeof lBinaryNum);
}
***************
*** 552,555 ****
--- 564,569 ----
* @param lBinaryNum a binary number
* @return the hexadecimal equivalent of <code>lBinaryNum</code>
+ * @return <code>NaN</code> if <code>lBinaryNum</code> is not a
+ * binary number
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
***************
*** 567,572 ****
}
! if ((typeof lBinaryNum != 'number') || (parseInt(lBinaryNum.toString()) != lBinaryNum)) {
! throw vError = new TypeMismatchException('Math.bin2hex', 'number', typeof lBinaryNum);
}
--- 581,586 ----
}
! if ((typeof lBinaryNum != 'number') || (lBinaryNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.bin2hex', 'long', typeof lBinaryNum);
}
***************
*** 596,599 ****
--- 610,615 ----
* @param lBinaryNum a binary number
* @return the octal equivalent of <code>lBinaryNum</code>
+ * @return <code>NaN</code> if <code>lBinaryNum</code> is not a
+ * binary number
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
***************
*** 611,616 ****
}
! if ((typeof lBinaryNum != 'number') || (parseInt(lBinaryNum.toString()) != lBinaryNum)) {
! throw vError = new TypeMismatchException('Math.bin2oct', 'number', typeof lBinaryNum);
}
--- 627,632 ----
}
! if ((typeof lBinaryNum != 'number') || (lBinaryNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.bin2oct', 'long', typeof lBinaryNum);
}
***************
*** 922,927 ****
}
! if ((typeof lDecimalNum != 'number') || (parseInt(lDecimalNum.toString()) != lDecimalNum)) {
! throw vError = new TypeMismatchException('Math.dec2bin', 'number', typeof lDecimalNum);
}
--- 938,943 ----
}
! if ((typeof lDecimalNum != 'number') || (lDecimalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.dec2bin', 'long', typeof lDecimalNum);
}
***************
*** 966,971 ****
}
! if ((typeof lDecimalNum != 'number') || (parseInt(lDecimalNum.toString()) != lDecimalNum)) {
! throw vError = new TypeMismatchException('Math.dec2hex', 'number', typeof lDecimalNum);
}
--- 982,987 ----
}
! if ((typeof lDecimalNum != 'number') || (lDecimalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.dec2hex', 'long', typeof lDecimalNum);
}
***************
*** 1010,1015 ****
}
! if ((typeof lDecimalNum != 'number') || (parseInt(lDecimalNum.toString()) != lDecimalNum)) {
! throw vError = new TypeMismatchException('Math.dec2oct', 'number', typeof lDecimalNum);
}
--- 1026,1031 ----
}
! if ((typeof lDecimalNum != 'number') || (lDecimalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.dec2oct', 'long', typeof lDecimalNum);
}
***************
*** 1231,1236 ****
}
! if ((typeof iX != 'number') || (parseInt(iX.toString()) != iX)) {
! throw vError = new TypeMismatchException('Math.fibonacci', 'number', typeof iX);
}
--- 1247,1252 ----
}
! if ((typeof iX != 'number') || (iX.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.fibonacci', 'integer', typeof iX);
}
***************
*** 1765,1768 ****
--- 1781,1785 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1778,1783 ****
}
! if ((typeof iX != 'number') || (parseInt(iX.toString()) != iX)) {
! throw vError = new TypeMismatchException('Math.isPrime', 'number', typeof iX);
}
--- 1795,1804 ----
}
! if ((typeof iX != 'number') || (iX.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.isPrime', 'integer', typeof iX);
! }
!
! if (iX < 2) {
! throw vError = new IllegalValueException('Math.isPrime', 'iX', '2 or greater', iX);
}
***************
*** 1955,1958 ****
--- 1976,1980 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1968,1973 ****
}
! if ((typeof lX != 'number') || (parseInt(lX.toString()) != lX)) {
! throw vError = new TypeMismatchException('Math.luhn', 'number', typeof lX);
}
--- 1990,1999 ----
}
! if ((typeof lX != 'number') || (lX.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.luhn', 'long', typeof lX);
! }
!
! if (lX < 10) {
! throw vError = new IllegalValueException('Math.luhn', 'lX', '10 or greater', lX);
}
***************
*** 2029,2034 ****
}
! if ((typeof lOctalNum != 'number') || (parseInt(lOctalNum.toString()) != lOctalNum)) {
! throw vError = new TypeMismatchException('Math.oct2bin', 'number', typeof lOctalNum);
}
--- 2055,2060 ----
}
! if ((typeof lOctalNum != 'number') || (lOctalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.oct2bin', 'long', typeof lOctalNum);
}
***************
*** 2073,2078 ****
}
! if ((typeof lOctalNum != 'number') || (parseInt(lOctalNum.toString()) != lOctalNum)) {
! throw vError = new TypeMismatchException('Math.oct2dec', 'number', typeof lOctalNum);
}
--- 2099,2104 ----
}
! if ((typeof lOctalNum != 'number') || (lOctalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.oct2dec', 'long', typeof lOctalNum);
}
***************
*** 2117,2122 ****
}
! if ((typeof lOctalNum != 'number') || (parseInt(lOctalNum.toString()) != lOctalNum)) {
! throw vError = new TypeMismatchException('Math.oct2hex', 'number', typeof lOctalNum);
}
--- 2143,2148 ----
}
! if ((typeof lOctalNum != 'number') || (lOctalNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.oct2hex', 'long', typeof lOctalNum);
}
***************
*** 2152,2155 ****
--- 2178,2182 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 2168,2173 ****
}
! if ((typeof iFormula != 'number') || (parseInt(iFormula.toString()) != iFormula)) {
! throw vError = new TypeMismatchException('Math.pi', 'number', typeof iFormula);
}
--- 2195,2204 ----
}
! if ((typeof iFormula != 'number') || (iFormula.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Math.pi', 'integer', typeof iFormula);
! }
!
! if ((iFormula != 0) && (iFormula != 1) && (iFormula != 2) && (iFormula != 3)) {
! throw vError = new IllegalValueException('Math.pi', 'iFormula', '0, 1, 2 or 3', iFormula);
}
|
|
From: <gat...@us...> - 2003-09-22 06:28:56
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv8309
Modified Files:
string.js
Log Message:
updated certain TypeMismatchExceptions to test for and display the correct datatype ('integer' instead of 'number') and updated methods with new error IllegalValueException
Index: string.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/string.js,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** string.js 21 Sep 2003 22:26:10 -0000 1.20
--- string.js 22 Sep 2003 06:28:47 -0000 1.21
***************
*** 355,360 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.insert', 'number', typeof iStart);
}
--- 355,360 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.insert', 'integer', typeof iStart);
}
***************
*** 524,527 ****
--- 524,528 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws MethodNotAvailableException
* @throws TypeMismatchException
***************
*** 551,556 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.lpad', 'number', typeof iMultiplier);
}
--- 552,561 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.lpad', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.lpad', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 639,642 ****
--- 644,648 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 655,660 ****
}
! if ((typeof iDocType != 'number') || (parseInt(iDocType.toString()) != iDocType)) {
! throw vError = new TypeMismatchException('String.nl2br', 'number', typeof iDocType);
}
--- 661,670 ----
}
! if ((typeof iDocType != 'number') || (iDocType.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.nl2br', 'integer', typeof iDocType);
! }
!
! if ((iDocType != 0) && (iDocType != 1)) {
! throw vError = new IllegalValueException('String.nl2br', 'iDocType', '0 or 1', iDocType);
}
***************
*** 713,718 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.overlay', 'number', typeof iStart);
}
--- 723,728 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.overlay', 'integer', typeof iStart);
}
***************
*** 769,772 ****
--- 779,783 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 793,802 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.pad', 'number', typeof iMultiplier);
}
! if ((typeof iSide != 'number') || (parseInt(iSide.toString()) != iSide)) {
! throw vError = new TypeMismatchException('String.pad', 'number', typeof iSide);
}
--- 804,821 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.pad', 'integer', typeof iMultiplier);
}
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.pad', 'iMultiplier', '0 or greater', iMultiplier);
! }
!
! if ((typeof iSide != 'number') || (iSide.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.pad', 'integer', typeof iSide);
! }
!
! if ((iSide != -1) && (iSide != 0) && (iSide != 1)) {
! throw vError = new IllegalValueException('String.pad', 'iSide', '-1, 0 or 1', iSide);
}
***************
*** 867,876 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.remove', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.remove', 'number', typeof iLength);
}
--- 886,895 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.remove', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.remove', 'integer', typeof iLength);
}
***************
*** 916,919 ****
--- 935,939 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 929,934 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.repeat', 'number', typeof iMultiplier);
}
--- 949,958 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.repeat', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.repeat', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 966,969 ****
--- 990,994 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 979,984 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.repeatChars', 'number', typeof iMultiplier);
}
--- 1004,1013 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.repeatChars', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.repeatChars', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 1046,1055 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.reverse', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.reverse', 'number', typeof iLength);
}
--- 1075,1084 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.reverse', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.reverse', 'integer', typeof iLength);
}
***************
*** 1168,1171 ****
--- 1197,1201 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws MethodNotAvailableException
* @throws TypeMismatchException
***************
*** 1195,1200 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.rpad', 'number', typeof iMultiplier);
}
--- 1225,1234 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.rpad', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.rpad', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 1331,1334 ****
--- 1365,1369 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1347,1352 ****
}
! if ((typeof iSide != 'number') || (parseInt(iSide.toString()) != iSide)) {
! throw vError = new TypeMismatchException('String.trim', 'number', typeof iSide);
}
--- 1382,1391 ----
}
! if ((typeof iSide != 'number') || (iSide.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.trim', 'integer', typeof iSide);
! }
!
! if ((iSide != -1) && (iSide != 0) && (iSide != 1)) {
! throw vError = new IllegalValueException('String.trim', 'iSide', '-1, 0 or 1', iSide);
}
***************
*** 1409,1414 ****
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.truncate', 'number', typeof iLength);
}
--- 1448,1453 ----
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.truncate', 'integer', typeof iLength);
}
***************
*** 1568,1571 ****
--- 1607,1611 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1593,1602 ****
}
! if ((typeof iColumnNum != 'number') || (parseInt(iColumnNum.toString()) != iColumnNum)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'number', typeof iColumnNum);
}
! if ((typeof iDocType != 'number') || (parseInt(iDocType.toString()) != iDocType)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'number', typeof iDocType);
}
--- 1633,1650 ----
}
! if ((typeof iColumnNum != 'number') || (iColumnNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'integer', typeof iColumnNum);
}
! if (iColumnNum < 1) {
! throw vError = new IllegalValueException('String.wordWrap', 'iColumnNum', '1 or greater', iColumnNum);
! }
!
! if ((typeof iDocType != 'number') || (iDocType.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'integer', typeof iDocType);
! }
!
! if ((iDocType != 0) && (iDocType != 1) && (iDocType != 2) && (iDocType != 3) && (iDocType != 4)) {
! throw vError = new IllegalValueException('String.wordWrap', 'iDocType', '0, 1, 2, 3 or 4', iDocType);
}
|
|
From: <gat...@us...> - 2003-09-22 06:02:44
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv4323
Modified Files:
array.js
Log Message:
updated certain TypeMismatchExceptions to test for and display the correct datatype ('integer' instead of 'number') and updated methods with new error IllegalValueException
Index: array.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/array.js,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** array.js 20 Sep 2003 19:55:44 -0000 1.27
--- array.js 22 Sep 2003 06:02:21 -0000 1.28
***************
*** 75,84 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'number', typeof iLength);
}
--- 75,84 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.averageDev', 'integer', typeof iLength);
}
***************
*** 145,148 ****
--- 145,149 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 158,163 ****
}
! if ((typeof iCase != 'number') || (parseInt(iCase.toString()) != iCase)) {
! throw vError = new TypeMismatchException('Array.changeKeyCase', 'number', typeof iCase);
}
--- 159,168 ----
}
! if ((typeof iCase != 'number') || (iCase.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.changeKeyCase', 'integer', typeof iCase);
! }
!
! if ((iCase != 0) && (iCase != 1)) {
! throw vError = new IllegalValueException('Array.changeKeyCase', 'iCase', '0 or 1', iCase);
}
***************
*** 213,218 ****
}
! if ((typeof iChunkSize != 'number') || (parseInt(iChunkSize.toString()) != iChunkSize)) {
! throw vError = new TypeMismatchException('Array.chunk', 'number', typeof iChunkSize);
}
--- 218,223 ----
}
! if ((typeof iChunkSize != 'number') || (iChunkSize.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.chunk', 'integer', typeof iChunkSize);
}
***************
*** 347,356 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.covar', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.covar', 'number', typeof iLength);
}
--- 352,361 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.covar', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.covar', 'integer', typeof iLength);
}
***************
*** 433,442 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.fill', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.fill', 'number', typeof iLength);
}
--- 438,447 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.fill', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.fill', 'integer', typeof iLength);
}
***************
*** 514,523 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.max', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.max', 'number', typeof iLength);
}
--- 519,528 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.max', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.max', 'integer', typeof iLength);
}
***************
*** 599,608 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.mean', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.mean', 'number', typeof iLength);
}
--- 604,613 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.mean', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.mean', 'integer', typeof iLength);
}
***************
*** 688,697 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.median', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.median', 'number', typeof iLength);
}
--- 693,702 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.median', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.median', 'integer', typeof iLength);
}
***************
*** 789,798 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.min', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.min', 'number', typeof iLength);
}
--- 794,803 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.min', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.min', 'integer', typeof iLength);
}
***************
*** 874,883 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.product', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.product', 'number', typeof iLength);
}
--- 879,888 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.product', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.product', 'integer', typeof iLength);
}
***************
*** 976,985 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.range', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.range', 'number', typeof iLength);
}
--- 981,990 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.range', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.range', 'integer', typeof iLength);
}
***************
*** 1070,1079 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'number', typeof iLength);
}
--- 1075,1084 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.standardDev', 'integer', typeof iLength);
}
***************
*** 1155,1164 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.sum', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.sum', 'number', typeof iLength);
}
--- 1160,1169 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.sum', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.sum', 'integer', typeof iLength);
}
***************
*** 1230,1239 ****
}
! if ((typeof iIndex1 != 'number') || (parseInt(iIndex1.toString()) != iIndex1)) {
! throw vError = new TypeMismatchException('Array.swap', 'number', typeof iIndex1);
}
! if ((typeof iIndex2 != 'number') || (parseInt(iIndex2.toString()) != iIndex2)) {
! throw vError = new TypeMismatchException('Array.swap', 'number', typeof iIndex2);
}
--- 1235,1244 ----
}
! if ((typeof iIndex1 != 'number') || (iIndex1.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.swap', 'integer', typeof iIndex1);
}
! if ((typeof iIndex2 != 'number') || (iIndex2.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.swap', 'integer', typeof iIndex2);
}
***************
*** 1314,1323 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('Array.variance', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('Array.variance', 'number', typeof iLength);
}
--- 1319,1328 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.variance', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('Array.variance', 'integer', typeof iLength);
}
|
|
From: <gat...@us...> - 2003-09-22 05:07:45
|
Update of /cvsroot/jspro/jsPro/debug
In directory sc8-pr-cvs1:/tmp/cvs-serv28960/debug
Modified Files:
debug.js
Log Message:
updated methods with new error IllegalValueException
Index: debug.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/debug/debug.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** debug.js 22 Sep 2003 03:28:22 -0000 1.5
--- debug.js 22 Sep 2003 05:07:41 -0000 1.6
***************
*** 101,104 ****
--- 101,105 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
* @throws UnknownException
***************
*** 120,123 ****
--- 121,128 ----
if ((typeof iMessageType != 'number') || (iMessageType.toString().indexOf('.') != -1)) {
throw vError = new TypeMismatchException('Debug.print', 'integer', typeof iMessageType);
+ }
+
+ if ((iMessageType != 0) && (iMessageType != 1)) {
+ throw vError = new IllegalValueException('Debug.print', 'iMessageType', '0 or 1', iMessageType);
}
|